PHP - No Idea Whats Wrong?
I can't honestly see whats wrong with this code,
it's print'ing correct with the print_r. Code: [Select] Array ( [value1] => 2 [option] => - [value2] => 1 ) however i can't actually echo out the value1,value2 or option? It says the vars are empty yet it can still print_r the values so i know there not empty Code: [Select] <?php if(isset($_POST["submit"])){ $value1=$_POST["value1"]; $value2=$_POST["value2"]; $option=$_POST["option"]; } print_r($_POST); echo"$value1"; ?> <form action="index.php" name="submit" method="post"> <input type="text" name="value1"> <select name="option"> <option>+</option> <option>-</option> <option>*</option> <option>/</option> </select> <input type="text" name="value2"> <input type="submit" value="submit"> </form> Similar TutorialsI'm fairly new to OOP, could you help me fix this? Thanks! class register{ //Setting up Variables, you can add more, for example EMAIL. private $_username; private $_password; //Giving the variables values function __construct($u_name, $p_word) { $this->_username = $u_name; $this->_password = $p_word; } if(isset($_POST['submit'])) { $reg = new register($_POST['username'], $_POST['password']); echo $reg->u_name; } Notice: Undefined property: register::$u_name in C:\wamp\www\register.php on line 23 Hi First of all, I know VERY little about PHP, The effort below is a wile guess that has gone wrong. I get this error Parse error: syntax error, unexpected T_IF in /home/repairyo/public_html/shop/includes/content/viewOrders.inc.php on line 57 I have no idea what ive done wrong, may be I am stupid for attempting it. Cheers Paul This is the original code Code: [Select] $view_orders->assign('VAL_STATE',$lang['glob']['orderState_'.$orders[$i]['status']]); This is the modified code Code: [Select] $view_orders->assign('VAL_STATE',$state = $results[$i]['status'] if ($state == '1') { "<font color='#ff9900'>".$lang['glob']['orderState_'.$results[$i]['status']]."</font>"; } else if ($state == '2') { "<font color='#009900'>".$lang['glob']['orderState_'.$results[$i]['status']]."</font>"; } else if ($state == '4') { "<font color='#cc0000'>".$lang['glob']['orderState_'.$results[$i]['status']]."</font>"; } else if ($state == '5') { "<font color='#cc0000'>".$lang['glob']['orderState_'.$results[$i]['status']]."</font>"; } else if ($state == '6') { "<font color='#cc0000'>".$lang['glob']['orderState_'.$results[$i]['status']]."</font>"; } else if ($state == '7') { "<font color='#ff9900'>".$lang['glob']['orderState_'.$results[$i]['status']]."</font>"; } else { $lang['glob']['orderState_'.$orders[$i]['status']]); } Cant Figure Out Whats Wrong With it.. Code: Code: [Select] <?php if(isset($_SESSION['user'])) { $bb = mysql_query("SELECT * FROM main WHERE id=". $_SESSION['id']) or die ("An error has occured: " . mysql_error()); while($n=mysql_fetch_array($bb)) { ?> <div class='cs_article'> <div class='left'> <h2>User Control Panel</h2> <p><a href="usercp.php">User CP</a><?php if($n['rights'] == 1) { echo ", <a href="modcp.php">Mod CP</a>"; }?> <?php if($n['rights'] == 2) { echo ", <a href="aa/">Admin CP</a>"; }?> <div class='button'><a href='usercp.php'>Read more</a></div> </div> <div class='right'> <h1>User CP</h1> </div> </div> <?php }} ?> What its doing: Mod-Justin Compared to Mod-Justin i dont know how to fix this problem..please help me guys --- so this is my index Code: [Select] <? session_start(); if(!isset($_SESSION['administrator'])){ header("location:../login.php"); } include ("../config.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>e-Leave</title> <link rel="stylesheet" href="../style.css" type="text/css" media="all" /> </head> <body> <!-- Header --> <div id="header"> <div class="shell"> <!-- Logo + Top Nav --> <div id="top"> <h1>e-Leave (Cpanel)</h1> <div id="top-navigation"> Welcome <a href="#"><strong><? $user=($_SESSION['administrator']); echo $user; ?></strong></a> <span>|</span> <a href="index.php">Home</a> <span>|</span> <a href="logout.php">Log out</a> </div> </div> <!-- End Logo + Top Nav --> <!-- Main Nav --> <? include ("../header/header_cpanel.php"); ?> <!-- End Main Nav --> </div> </div> <!-- End Header --> <!-- Container --> <div id="container"> <div class="shell"> <!-- Main --> <div id="main"> <div class="cl"> </div> <!-- Content --> <div id="content"> <? if(isset($_GET[view])) { $view = $_GET[view]; } if ($view == '' ){ include ('employeeleaveapplication.php'); } if ($view == 'createaccount' ){ include ('createaccount.php'); } if ($view == 'createaccounta' ){ include ('createaccount_add.php'); } if ($view == 'createaccounti' ){ include ('createaccount_insert.php'); } if ($view == 'createaccountd' ){ include ('createaccount_delete.php'); } if ($view == 'createaccounte' ){ include ('createaccount_edit.php'); } if ($view == 'createaccountu' ){ include ('createaccount_update.php'); } if ($view == 'createlogina' ){ include ('createlogin_add.php'); } if ($view == 'createlogini' ){ include ('createlogin_insert.php'); } if ($view == 'employeedirectory' ){ include ('employeedirectory.php'); } if ($view == 'employeedirectoryl' ){ include ('employeedirectory_list.php'); } if ($view == 'employeedirectorya' ){ include ('employeedirectory_adjustment.php'); } if ($view == 'employeedirectoryai' ){ include ('employeedirectory_adjustment_insert.php'); } if ($view == 'employeedirectoryca' ){ include ('employeedirectory_cancel_adjustment.php'); } if ($view == 'employeedirectorycl' ){ include ('employeedirectory_cancel_application.php'); } if ($view == 'changepassword' ){ include ('changepassword.php'); } if ($view == 'changepasswordi' ){ include ('changepassword_insert.php'); } if ($view == 'branch' ){ include ('setup_branch.php'); } if ($view == 'brancha' ){ include ('setup_branch_add.php'); } if ($view == 'branchi' ){ include ('setup_branch_insert.php'); } if ($view == 'branchd' ){ include ('setup_branch_delete.php'); } if ($view == 'branche' ){ include ('setup_branch_edit.php'); } if ($view == 'branchu' ){ include ('setup_branch_update.php'); } if ($view == 'designation' ){ include ('setup_designation.php'); } if ($view == 'designationa' ){ include ('setup_designation_add.php'); } if ($view == 'designationi' ){ include ('setup_designation_insert.php'); } if ($view == 'designationd' ){ include ('setup_designation_delete.php'); } if ($view == 'designatione' ){ include ('setup_designation_edit.php'); } if ($view == 'designationu' ){ include ('setup_designation_update.php'); } if ($view == 'leavetype' ){ include ('setup_leavetype.php'); } if ($view == 'leavetypea' ){ include ('setup_leavetype_add.php'); } if ($view == 'leavetypei' ){ include ('setup_leavetype_insert.php'); } if ($view == 'leavetyped' ){ include ('setup_leavetype_delete.php'); } if ($view == 'leavetypee' ){ include ('setup_leavetype_edit.php'); } if ($view == 'leavetypeu' ){ include ('setup_leavetype_update.php'); } if ($view == 'publicholiday' ){ include ('setup_publicholiday.php'); } if ($view == 'publicholidayd' ){ include ('setup_publicholiday_delete.php'); } if ($view == 'publicholidaya' ){ include ('setup_publicholiday_add.php'); } if ($view == 'publicholidayi' ){ include ('setup_publicholiday_insert.php'); } if ($view == 'publicholidaye' ){ include ('setup_publicholiday_edit.php'); } if ($view == 'publicholidayu' ){ include ('setup_publicholiday_update.php'); } if ($view == 'report' ){ include ('report.php'); } if ($view == 'report_leave' ){ include ('report_leave.php'); } if ($view == 'print' ){ include ('report_print.php'); } ?> </div> <!-- End Content --> <!-- Sidebar --> <? include ("../header/dashboard_cpanel.php"); ?> <!-- End Sidebar --> <div class="cl"> </div> </div> <!-- Main --> </div> </div> <!-- End Container --> <div id="footer"> <? include ("../footer/footer.php"); ?> </div> </body> </html> -- this is my dashboard panel code Code: [Select] <div id="sidebar"> <!-- Box --> <div class="box"> <!-- Box Head --> <div class="box-head"> <h2><b>Dashboard</b></h2> </div> <!-- End Box Head--> <div class="box-content"> <a href="index.php?view=createaccount"><span> <img src="../images/createaccount.jpg"/> Create Account</span></a> <div class="cl"> </div> <div class="cl"> </div> <a href="index.php?view=employeedirectory"><br><span> <img src="../images/employee.jpg"/> Employee Directory</span></a> <div class="cl"> </div> <a href="index.php?view=report"><br><span> <img src="../images/status-report1.jpg"/> Report</span></a> <div class="cl"> </div> <div class="cl"> </div><a href="index.php?view=changepassword"><br> <span> <img src="../images/key.jpg"/> Change Password</span></a> </div> </div> <div class="box"> <!-- Box Head --> <div class="box-head"> <h2><b>Setup</b></h2> </div> <!-- End Box Head--> <div class="box-content"> <a href="index.php?view=branch"><br><span> <img src="../images/branch.jpg"/> Branch</span></a> <div class="cl"> </div> <div class="cl"> </div><a href="index.php?view=designation"><br> <span> <img src="../images/designation.jpg"/> Designation</span></a> <div class="cl"> </div> <div class="cl"> </div><br> <a href="index.php?view=leavetype"><span> <img src="../images/leave.jpg"/> Leave Type</span></a> <div class="cl"> </div> <div class="cl"> </div><br> <a href="index.php?view=publicholiday"><span> <img src="../images/pb.jpg"/> Public Holiday</span></a> </div> </div> </div> ----- and this is the where the problem page is Code: [Select] <!-- Box --> <div class="box"> <!-- Box Head --> <div class="box-head"> <h2 class="left">Report</h2> </div> <!-- End Box Head --> <!-- Table --> <div class="table"> <div class="right"> <br> </div> <div id="box" valign="top"> <br> <h3><FORM name ="reportbutton" method="post" align="left" action="index.php?view=report"> <strong>Leave Application Listing </strong>| <Input type = "Submit" Name = "Submit1" Class="button" VALUE = "Back To Report"> </h3> </FORM> <br><br> <form name="leavebutton" method="post" action="index.php?view=report_leave"> <? $b=$_GET['b']; $m=$_GET['m']; $y=$_GET['y']; if ($b <> '' && $m <> '' && $y <> '') { $branch=$b; $leavemonth=$m; $leaveyear=$y; } else { $branch=$_POST['branch']; $leavemonth=$_POST['leavemonth']; $leaveyear=$_POST['leaveyear']; } $connection=mysql_connect("$server", "$username", "$password") or die("Could not establish connection"); mysql_select_db($database_name, $connection) or die ("Could not select database"); $query="SELECT * from tblworkgroup"; $result=mysql_query($query);?> Branch <select name="branch" > <option value="all">ALL Branches</option> <? while($row=mysql_fetch_array($result)) { ?> <option value= "<?=$row['WorkGroupID']?>" <? if ($branch==$row['WorkGroupID']){ echo 'selected'; } ?> ><?=$row['WorkGroupName']?></option> <? } ?> </select> </td> </tr> <br><br><br> Month <select name="leavemonth" > <option value = "1" <? if ($leavemonth==1){ echo 'selected'; } ?>>January</option> <option value = "2" <? if ($leavemonth==2){ echo 'selected'; } ?>>February</option> <option value = "3" <? if ($leavemonth==3){ echo 'selected'; } ?>>March</option> <option value = "4" <? if ($leavemonth==4){ echo 'selected'; } ?>>April</option> <option value = "5" <? if ($leavemonth==5){ echo 'selected'; } ?>>May</option> <option value = "6" <? if ($leavemonth==6){ echo 'selected'; } ?>>June</option> <option value = "7" <? if ($leavemonth==7){ echo 'selected'; } ?>>July</option> <option value = "8" <? if ($leavemonth==8){ echo 'selected'; } ?>>August</option> <option value = "9" <? if ($leavemonth==9){ echo 'selected'; } ?>>September</option> <option value = "10" <? if ($leavemonth==10){ echo 'selected'; } ?>>October</option> <option value = "11" <? if ($leavemonth==11){ echo 'selected'; } ?>>November</option> <option value = "12" <? if ($leavemonth==12){ echo 'selected'; } ?>>December</option> </select> Year <select name="leaveyear" > <option value = "2010" <? if ($leaveyear==2010) { echo 'selected';} ?>>2010</option> <option value = "2011" <? if ($leaveyear==2011) { echo 'selected';} ?>>2011</option> <option value = "2012" <? if ($leaveyear==2012) { echo 'selected';} ?>>2012</option> <option value = "2013" <? if ($leaveyear==2013) { echo 'selected';} ?>>2013</option> <option value = "2014" <? if ($leaveyear==2014) { echo 'selected';} ?>>2014</option> <option value = "2015" <? if ($leaveyear==2015) { echo 'selected';} ?>>2015</option> <option value = "2016" <? if ($leaveyear==2016) { echo 'selected';} ?>>2016</option> <option value = "2017" <? if ($leaveyear==2017) { echo 'selected';} ?>>2017</option> </select> <input type='submit' name='submit' value='Preview' Class="button" onclick='return validate()'> </div> </form> <br /><br /> <div id="box" valign="top"> <h3> <strong>Leave Application Details</strong>  </h3> <br><br> <FORM name="printbutton" method="post" align="left" action="report_print.php" target="_blank"> <input type="hidden" name="leavemonth" value="<?php echo $leavemonth; ?>"> <input type="hidden" name="leaveyear" value="<?php echo $leaveyear; ?>"> <input type="hidden" name="branch" value="<?php echo $branch;?>"> <Input type = "Submit" Name = "Submit1" Class="button" VALUE = "Print Leave Details"> </form> <table width="80%" align="center" > <thead> <tr> <th width="700px" align="left">Name</a></th> <th width="500px" align="center"></a>Application Date</th> <th width="500px" align="center"></a> </th> <th width="500x" align="right"></a>Reason</th> </tr> </thead> <tbody> <? /*echo "branch:".$branch.'<br />'; echo "leavemonth:".$leavemonth.'<br />'; echo "leaveyear:".$leaveyear.'<br />';*/ //-------------------------------------------------- if ($leavemonth =='' || $leaveyear =='' || $branch == '') { // one value missing, so don't display } else { // start display data $branchtracker = ''; if ($branch=='all'){ $branch = '%'; } $rs = mysql_query( " call vwleavereport('$leavemonth', '$leaveyear', $branch, 0);"); $query="SELECT *, MONTH(tblleaveapplication.DateFrom) as DFMonth, MONTH(tblleaveapplication.DateTo) as DTMonth, YEAR(tblleaveapplication.DateFrom) as DFYear FROM `tblleaveapplication` LEFT JOIN `tblemployee` ON tblleaveapplication.employeeid = tblemployee.id WHERE WorkGroupID LIKE '".$branch."' AND ( (MONTH(tblleaveapplication.DateFrom)=".$leavemonth." AND YEAR(tblleaveapplication.DateFrom)=".$leaveyear.") OR (MONTH(tblleaveapplication.DateTo)=".$leavemonth." AND YEAR(tblleaveapplication.DateFrom)=".$leaveyear.") ) ORDER BY WorkGroupID "; $result = mysql_query($query); while($row=mysql_fetch_array($result)) { if ($branchtracker<>$row['WorkGroupID']){ echo '<tr><td colspan=4 style="background-color: #e8e8e8; font-weight: bold;">'.$row['WorkGroupID'].'</td></tr>'; $branchtracker = $row['WorkGroupID']; } echo '<tr>'; echo '<td>'.$row['EmployeeName'].'</td>'; echo '<td>'.$row['DateFrom'].'</td>'; echo '<td>'.$row['DateTo'].'</td>'; echo '<td>'.$row['Purpose'].'</td>'; echo '</tr>'; } } ?> </table> The problem is the panel should be out on the RIGHT side..how do i fix it. hi all me again i have this bit of code mysql_connect($db_hostname,$db_username,$db_password); @mysql_select_db($db_database) or die( "Unable to select database"); $whereClauses = array(); if(isset($_GET['bi'])) { $whereClauses[] = "bi=1"; } if(isset($_GET['print'])) { $whereClauses[] = "print=1"; } if(isset($_GET['online'])) { $whereClauses[] = "online=1"; } $query = "SELECT * FROM `project` ORDER BY `project`.`position` ASC "; if(count($whereClauses)) { $query .= " WHERE " . implode(" AND ", $whereClauses); } with this error msg There was a problem with the SQL query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE online=1' at line 3 I get this kinda error a lot as im still learning is there any way to better find out whats going wrong i use error_reporting(E_ALL); ini_set('display_errors', '1'); at the start of my scripts but it dont tell me a lot. i can work out it some thing to do with the $whereClauses as the page displays ok on show all. Im bit stumped here not even sure what to call the prob is it sql query error or php array problem thanks for any help Its a page 'Downloads'. Works great at localhost but doesnt show up @ web hosting. Code: [Select] <?php define('IN_PHPBB', true); $page = !isset($_GET["page"]) ? "None" : $_GET['page']; $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); // Start session management $user->session_begin(); $auth->acl($user->data); $user->setup(); page_header('Downloads'); if(strcmp($page,"org") == 0) { $template->set_filenames(array('body' => 'download/org.html',)); } else if(strcmp($page,"audi") == 0) { $template->set_filenames(array('body' => 'download/audi.html',)); } else if(strcmp($page,"bmw") == 0) { $template->set_filenames(array('body' => 'download/bmw.html',)); } else if(strcmp($page,"vw") == 0) { $template->set_filenames(array('body' => 'download/vw.html',)); } else if(strcmp($page,"nissan") == 0) { $template->set_filenames(array('body' => 'download/nissan.html',)); } else if(strcmp($page,"opel") == 0) { $template->set_filenames(array('body' => 'download/opel.html',)); } else if(strcmp($page,"ford") == 0) { $template->set_filenames(array('body' => 'download/ford.html',)); } else if(strcmp($page,"chevrolet") == 0) { $template->set_filenames(array('body' => 'download/chevrolet.html',)); } else if(strcmp($page,"other") == 0) { $template->set_filenames(array('body' => 'download/other.html',)); } else { $template->set_filenames(array('body' => 'download/org.html',)); } make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); page_footer(); ?> and the html: Code: [Select] <table class="tablebg" cellspacing="1" width="100%"> <tr> <th>BMW</th> </tr> <tr class="row1"> <td align="center" style="padding:5px 5px 5px 5px;"> <center> <hr width="60%" size="3" /> <table width="70%"> <tr> <td width="10%"><a href="http://www.upload.ee/image/1626514/325i_2.jpg" target = "_blank"> <img src="http://www.upload.ee/thumb/1626514/325i_2.jpg" border="0"/></a> <a href="http://www.upload.ee/image/1626518/325i_3.jpg"> <img src="http://www.upload.ee/thumb/1626518/325i_3.jpg" border="0"/></a> <td width="0%"><a href="http://www.upload.ee/image/1626519/325i_1.jpg" target = "_blank"> <img src="http://www.upload.ee/thumb/1626519/325i_1.jpg" border="0"/></a> <a href="http://www.upload.ee/image/1626521/325i_4.jpg" target = "_blank"> <img src="http://www.upload.ee/thumb/1626521/325i_4.jpg" border="0"/></a></td></td> <td><b><font color="white">Name:</font></b> 1996 BMW 325i e36 Convertible</br> <b><font color="white">Original Author:</font></b> ikey07</br> <b><font color="white">Size:</font></b> 3.89MB</br></br> <b><font color="white">Description:</font></b></br> Tunable in WAA</br> 2 Body kits included</br> 1. BMW M e36 series + Hood Vents</br> 2. BMW M e46 series + Masked Lights</br> New 2 M series wheels e36/e46</br> Realistic heavy damaged model</br> Model accuracy as real car 96%</br> Openable petrolcap</br> If you replace this car as BF Injection, the front fan is working ( spining )</br></br> <a href="http://ikey07.c-rp.net/viewtopic.php?f=6&t=2"><b><font color="white">Comments</font></b></a></br> </br> <ul id="nav"> <a class="downl" href="http://ikey07.c-rp.net/download/1996_BMW_325i_e36.rar" title="Download"><span>{L_DOWN}</span></a> </div> </br> </td> </tr> </table> <hr width="60%" size="3" /> </center> </td> </tr> </table> <br /> can you tell me whats wrong with this? Code: [Select] <?php $age= 60; if( isset($_SESSION['logedin']) ) { $q = mysql_query('SELECT id=`$id`, DATE_FORMAT(`last_activity`,"%a, %b %e %T") as `last_activity`,UNIX_TIMESTAMP(`last_activity`) as `last_activity_stamp`FROM `mymembers`WHERE `$logOptions_id` <> "'.($_SESSION['logedin']).'"'); $isonlinecheck = mysql_query($q); if ($isonlinecheck ="last_activity_stamp + $age "< time()){ $isonline = "is <font color='green'>online!</font>";} else { $isonline = "is<font color='red'> offline!</font>"; } } ?> ive looked at this for a while now and im not sure whats wrong, the error occured when i entered $cat and catagory into it, without that the query works perfectly fine, any help appreciated. <?php INSERT INTO newnotes (uid, name, catagory, location) VALUES ('1', 'test', '1001 Laws - Polceing', '/home/mikeh/public_html/uzEr Upl0ds/Alyssa O'Leary.doc') the <php tag is only to give color and make it less dull the query is from a die($query) statment This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=358008.0 hi all, I have possibly up to 9 images that I want to find and show on a webpage. I am trying to put a $file in a loop and get all the .jpg images that are found in to an array and show them all. I think from the script you can see what I am attempting to do! Any pointers would be grateful for <?php while($i=0 $i < 9 $i++) { $file = "aircraft/".$_GET['reg'].$i.".jpg"; } foreach($file) { echo "<li class=\"active\"><img src=\"./aircraft/".$reg.$i.".jpg\" alt=\"Flowing Rock\" style=\"width: auto; height: 70px; margin-left: -28.5px; display: block;\" class=\"thumb\" ><br />"; } ?> hello. i have a column called "pageName" and on the each page i have put $pName = "the name of that page". i want to pull from the database all the information where the $pName on the page is the same as the pageName in the database its getting the $pName = "adminHome" but it thinks its the name of the column not the row. this is the error im getting: Quote DATABASE.PHP - confirm_query = MySQL Datatbase Query Failed: Unknown column 'adminHome' in 'where clause' Last SQL query: SELECT * FROM pages WHERE pageName=adminHome this is the function code Code: [Select] public static function find_by_pageName($pName=""){ global $database; $sql = "SELECT * FROM ".self::$table_name." WHERE pageName=".$database->escape_value($pName).""; $result_array = self::find_by_sql($sql); return !empty($result_array) ? array_shift($result_array) : false; } this is the page code Code: [Select] <?PHP require_once("../includes/initialize.php"); $pName = "adminHome"; $page = Pages::find_by_pageName($pName); ?> thanks rick Code: [Select] <?php function dbConnect($usertype, $connectionType = 'mysqli') { $host = 'localhost'; $db = 'gallery'; if ($usertype == 'read') { $user = 'psread'; $pwd = '####'; } elseif ($usertype == 'write') { $user = 'pswrite'; $pwd = '####'; } else { exit('Unrecognized connection type'); } if ($connectionType == 'mysqli') { return new mysqli($host, $user, $pwd, $db) or die ('Cannot open database'); } } ?> when i call upon the function i get this message Fatal error: Call to a member function query() on a non-object in C:\webs\phpsolutions\comments.php on line 8 from this code Code: [Select] <?php require_once('includes/connection.php'); // connect to MySQL $conn = dbConnect('write'); // prepare the SQL query $sql = 'SELECT * FROM images'; // submit the query and capture the result $result = $conn->query($sql) or die(mysqli_error()); // find out how many records were retrieved $numRows = $result->num_rows; ?> $search
= $_POST['search']; $replace = $_POST['replace']; $zero = 0; $gibs = mysql_query("SELECT * FROM anime"); while ($gib = mysql_fetch_assoc($gibs)) { $new_description[] = str_replace($search,$replace,$gib['description']); $new_history[] = str_replace($search,$replace,$gib['history']); $anime_id[] = $gib['anime_id']; $numberlinks = ++$zero; } for($i=0; $i<$numberlinks; $i++) { $thequery[] = mysql_query("UPDATE anime SET description = '".mysql_real_escape_string($new_description[$i])."', history='".mysql_real_escape_string($new_history[$i])."' WHERE anime_id='".$anime_id[$i]."'"); } foreach ($thequery as $query){ mysql_query($query) or die (mysql_error()); echo "<span style='color:green'>Edited sucessfully <b>Anime ".++$one."</b> </span><br/>"; } echo "<meta http-equiv='refresh' content='2;url=http://www.website.com/forums/downloads-manager.php?task=fix-descriptions'>"; output: Code: [Select] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1[/b] Inputs: $search: ’ $replace: " Hi all, Yeah just a fresh pair of eyes needed. It just wont insert into the table and the alert returns a blank. Only thing I can think is thats its posting variables from two different queries...but that shouldnt make a difference... Cheers Code: [Select] FORM PAGE************************* //*****************************LOGGED CHECKER********************* $sql = "SELECT * FROM users WHERE firstName= '$logged'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { if ($row = mysql_fetch_assoc($result)) { //**************QUESTION FORM***************************** $sql2 = "SELECT * FROM questions WHERE questionID= '$orderCounter'"; if ($result2 = mysql_query($sql2)) { if (mysql_num_rows($result2)) { if ($row2 = mysql_fetch_assoc($result2)) { echo "<p>" . $row2['questionText'] . "</p>"; echo '<form name="form1" method="post" action="questionProcess.php">'; echo '<input type="radio" name="q1" value="' . $row2['answer1'] . '" />' . $row2['answer1'] . '<br />'; echo '<input type="radio" name="q1" value="' . $row2['answer2'] . '" />' . $row2['answer2'] . '<br />'; echo '<input type="radio" name="q1" value="' . $row2['answer3'] . '" />' . $row2['answer3'] . '<br />'; echo '<input type="radio" name="q1" value="' . $row2['answer4'] . '" />' . $row2['answer4'] . '<br />'; echo '<input type="hidden" name="userid" value="' . $row['userid'] . '" />'; echo '<input type="hidden" name="orderCounter" value="' . $row['orderCounter'] . '" />' echo '<input type="submit" name="Submit" id="Submit" value="Next" />'; echo '</label>'; echo '</form>'; } } } } } } ?> PROCESSING PAGE**************************************** $q1=$_POST['q1']; $userid=$_POST['userid']; $orderCounter=$_POST['orderCounter']; // To protect MySQL injection $q1 = stripslashes($q1); $userid = stripslashes($userid); $orderCounter = stripslashes($orderCounter); $q1 = mysql_real_escape_string($q1); $userid = mysql_real_escape_string($userid); $orderCounter = mysql_real_escape_string($orderCounter); //ALERT CHECKER function confirm($msg) { echo "<script langauge=\"javascript\">alert(\"".$msg."\");</script>"; } $msg = $userid; confirm($msg); //ALERT CHECKER if ($q1 == "" ) { $wrong = '<div id="blackText"><p>Please Answer the Question<p></div>'; } else { $sql="INSERT INTO $tbl_name (userid, value, orderCounter) VALUES ('$userid', '$q1', '$orderCounter')"; $result=mysql_query($sql); } ob_end_flush(); ?> hi all, Is this line right? Im trying to say if the cookie has not been created create it and set as default value = 0 however i dont think this is right: Code: [Select] $points = $_COOKIE["points"] ? $_COOKIE['points']:0; thanks, Not sure what is wrong with line 17
<?php $hostname="localhost"; //local server name default localhost $username="root"; //mysql username default is root. $password=""; //blank if no password is set for mysql. $database="login"; //database name which you created $con=mysql_connect($hostname,$username,$password); if(! $con) { die('Connection Failed'.mysql_error()); } mysql_select_db($database,$con); //include connect.php page for database connection Include('connect.php') //if submit is not blanked i.e. it is clicked. If(isset($_REQUEST['submit'])!='') { If($_REQUEST['name']=='' || $_REQUEST['email']=='' || $_REQUEST['password']==''|| $_REQUEST['repassword']=='') { Echo "please fill the empty field."; } Else { $sql="insert into student(name,email,password,repassword) values('".$_REQUEST['name']."', '".$_REQUEST['email']."', '".$_REQUEST['password']."', '".$_REQUEST['repassword']."')"; $res=mysql_query($sql); If($res) { Echo "Record successfully inserted"; } Else { Echo "There is some problem in inserting record"; } } } ?> Edited by Metoriium, 25 October 2014 - 05:04 PM. Whats wrong with this code ? Code: [Select] <?php $dbc = mysqli_connect('localhost', 'boyyo_boyyo', 'KiaNNa11', 'boyyo_aliendatabase') or die('Error connecting to MySQL server.'); $first_name = $_POST['firstname']; $last_name = $_POST['lastname']; $email = $_POST['email']; $query = "INSERT INTO email_list (first_name, last_name, email) " . "VALUES ('$first_name', '$last)name', '$email')"; mysqli_query($dbc, $query ) or die('Error querying database.'); echo 'Customer added. ' ; mysqli_close($dbc); ?> I have no idea whats wrong with this code? Hello,
I am trying to make 'onclick img' that will provide a Linux command when clicked.
I've been trying this code:
<body> <?php include("connect.php"); include('Net/SSH2.php'); *** CONNECTION TO DATABASE MYSQL CODE *** if(mysql_num_rows($result) > 0) { while($row = mysql_fetch_array($result)) { $_SESSION['logged'] = true; $ssh = new Net_SSH2('xx.xx.xx.xx'); if (!$ssh->login($info['username'], $info['password'])) { exit('Connection to Linux has failed, please try again.'); } echo '<form action="" method="GET">'; echo '<input type="image" src="start.png" width=100 height=100 name="start" />'; echo '</form>'; if(isset($_GET['start'])) { echo $ssh->setTimeout(5); echo $ssh->exec('(cd '.$info['username'].' ; nohup ./samp03svr &)'); } } } else { $_SESSION['logged'] = null; header("Location: loginfail.php"); } ?> </body>But when I clicked the image, it sends me to "loginfail.php". Please help >< File will not include, have I missed something? Thanks Code: [Select] if ($arrPage['include']===false) { if (function_exists($arrPage['function_name'])) { call_user_func($arrPage['function_name']); } else if ($arrPage['function_name']!='') { echo '<div id="page">'; alert_box('Function not found', 'The function '.$arrPage['function_name'].' does not appear to exist. Please check with the plugin author.'); echo '</div>'; } } else { $includePath = dirname('$url').'/'.$arrPage['include']; if (file_exists($includePath)) { include_once($includePath); if (function_exists($arrPage['function_name'])) { call_user_func($arrPage['function_name']); } else if ($arrPage['function_name']!='') |