PHP - Wrong Images!
Hello,
I have been wrestling with this forth past couple of days and cannot work out what is wrong. The code below works ok except when I wish to change the picture. Instead of changing the image with the corresponding images it uses the "nopic" image even though the correct image is still in the database. So for example if I enter some data with one image attached this appears correctly. If I then change the image the old image reverts to "nopic" and the new image is displayed with the latest data. Even though in the database the old image is still present Hope this makes sense What am I doing wrong? offending code below Any help greatly appreciated Code: [Select] // Connect to the database $dbc = mysqli_connect(DB_Host, DB_User, DB_Password, DB_Name); // Retrieve the user data from MySQL $query = "SELECT * FROM conversation where topic = 'polls' "; //$data = mysqli_query($dbc, $query); echo '<table>'; $result = mysqli_query($dbc, $query); while ($row = mysqli_fetch_array($result)) { if (is_file(MM_UPLOADPATH . $row['picture']) && filesize(MM_UPLOADPATH . $row['picture']) > 0) { echo '<tr><td class="label"></td><td><img src="' . MM_UPLOADPATH . $row['picture'] . '" alt="Profile Picture" style="width:75px; max-height:55px;" /> ' . $row["quote"] . ''; } else { echo '<tr><td class="label"></td><td><img src=" ' . MM_UPLOADPATH . 'nopic.png" style="width:60px; maxheight=44px;" /> ' . $row["quote"] . ''; } } echo '</tr>'; echo '</table>' ?> Similar TutorialsI am querying... $sql = "SELECT `messages_inbox`.`message_id`, `users`.`firstname`, `users`.`lastname`, `users`.`username` AS `from`, '${user_info['username']}' AS `to`, `subject`, LENGTH(`files`) AS `len`, 'inbox' AS `box`, DATE_FORMAT(`messages_inbox`.`time` ,'%T %D-%M-%Y') AS `time` "; $sql .= "FROM `messages_inbox` INNER JOIN `users` ON `messages_inbox`.`from_id` = `users`.`id` WHERE `to_id` = ${user_info['uid']} AND `messages_inbox`.`deleted` = 0 ORDER BY `messages_inbox`.`message_id` DESC"; and I am trying to output $displayName = ucwords("${message['firstname']} ${message['lastname']}"); by using $messages = pm_fetch_all($_GET['box']); I know my fetch works but for some reason firstname and lastname are only returning the logged in users first name and last name, not the person who sent the message. I have this script from http://lampload.com/...,view.download/ (I am not using a database) I can upload images fine, I can view files, but I want to delete them. When I press the delete button, nothing happens
http://www.jayg.co.u...oad_gallery.php
<form>
<?php $dir = dirname(__FILENAME__)."/images/gallery" ; $files1 = scandir($dir); foreach($files1 as $file){ if(strlen($file) >=3){ $foil = strstr($file, 'jpg'); // As of PHP 5.3.0 $foil = $file; $pos = strpos($file, 'css'); if ($foil==true){ echo '<input type="checkbox" name="filenames[]" value="'.$foil.'" />'; echo "<img width='130' height='38' src='images/gallery/$file' /><br/>"; // for live host //echo "<img width='130' height='38' src='/ABOOK/SORTING/gallery-dynamic/images/gallery/ $file' /><br/>"; } } }?> <input type="submit" name="mysubmit2" value="Delete"> </form>
any ideas please?
thanks
Can someone please take a look and see if you can point out what error i made. Everything on the form side is functioning except it doesn't seem to post since its looping back to the form rather than the redirect. Also, within the actual form table, i had to change the section that says Business Hours from a textarea because I couldn't get it to echo the data from the field in the database. Any ideas on that would be greatly appreciated. Sorry if its a bit sloppy, I'm no expert. Code: [Select] <?php include "config.php"; mysql_connect("$dbhost","$dbusr","$dbpass"); mysql_select_db("$dbname"); session_start(); if (isset($_SESSION['user'])) { } else { header ('location: login.php'); } // creates the edit record form // since this form is used multiple times in this file, I have made it a function that is easily reusable function renderForm($id, $username, $location, $address, $city, $zip, $county, $website, $map, $email, $phone, $bhours, $ptimes, $pspecials, $vspecials, $error) { echo "<center><strong>Edit Location Information</strong></center>"; // if there are any errors, display them if ($error != '') { echo '<div style="padding:4px; border:1px solid red; color:red;">'.$error.'</div>'; } echo " <center> <form action='' method='POST'> <table border='0' frame='box'> <tr> <td width='96'><div align='right'>Venue ID:</div></td> <td colspan='2'><input type='hidden' name='id' value='$id'>$id</td> </tr> <tr> <td><div align='right'><font size='2' face='arial'>Username:</font></div></td> <td colspan='2'><input type='text' name='r_username' value='$username'></td> </tr> <tr> <td>Business Name:</td> <td colspan='2'><input type='text' name='r_location' value='$location'></td> </tr> <tr> <td><div align='right'><font size='2' face='arial'>Address:</font></div></td> <td colspan='2'><input type='text' name='r_address' value='$address'></td> </tr> <tr> <td><div align='right'>City/State:</div></td> <td><input type='text' name='r_city' value='$city'></td> <td>Format = City, St</td> </tr> <tr> <td><div align='right'><font size='2' face='arial'>Zip:</font></div></td> <td colspan='2'><input type='text' name='r_zip'value='$zip'></td> </tr> <tr> <td><div align='right'>County:</div></td> <td colspan='2'><input type='text' name='r_county'value='$county'></td> </tr> <tr> <td><div align='right'>Website:</div></td> <td colspan='2'><input type='text' name='r_website' value='$website'></td> </tr> <tr> <td><div align='right'>Directions:</div></td> <td colspan='2'><input type='text' name='r_map' value='$map'></td> </tr> <tr> <td><div align='right'><font size='2' face='arial'>E-mail:</font></div></td> <td colspan='2'><input type='text' name='r_email' value='$email'></td> </tr> <tr> <td><div align='right'><font size='2' face='arial'>Phone #::</font></div></td> <td colspan='2'><input type='text' name='r_phone' value='$phone'></td> </tr> <tr> <td height='80'><div align='right'><font size='2' face='arial'>Business Hours:</font></div></td> <td width='287'><input type='text' name='r_bhours' cols='45' rows='3' value='$bhours'></td> <td width='244'><p>**You must enter </br> after each line to display in rows:</p> <p>Mon - Fri 11am to 10pm</br></p> <p>Sat - Sun 1PM to 3am</br></p></td> </tr> <tr> <td><div align='right'><font size='2' face='arial'>Poker Times:</font></div></td> <td colspan='2'><input type='text' name='r_ptimes' value='$ptimes'></td> </tr> <tr> <td><div align='right'><font size='2' face='arial'>Poker Specials:</font></div></td> <td><input type='text' name='r_pspecials' value='$pspecials'></td> <td> </td> </tr> <tr> <td><div align='right'><font size='2' face='arial'>Location Specials:</font></div></td> <td><input type'text' name='r_vspecials' cols='45' rows='3' value='$vspecials'></td> <td><p>**You must enter </br> after each line to display in rows:</p> <p>Mon - $0.10 Wings</br></p> <p>Fri - 2 for 1 Happy hour</br></p></td> </tr> <tr> <td></td> <td colspan='2'><div align='center'><font size='2' face='arial'><a href='edituser.php'>Cancel</a> - </font><input type='submit' value='Update Location'></div></td> </tr> </table> </form> </center> "; } // check if the form has been submitted. If it has, process the form and save it to the database if (isset($_POST['submit'])) { // confirm that the 'id' value is a valid integer before getting the form data if (is_numeric($_POST['id'])) { // get form data, making sure it is valid $id = $_POST['id']; $username = mysql_real_escape_string(htmlspecialchars($_POST['username'])); $location = mysql_real_escape_string(htmlspecialchars($_POST['loc_name'])); $address = mysql_real_escape_string(htmlspecialchars($_POST['address'])); $city = mysql_real_escape_string(htmlspecialchars($_POST['city'])); $zip = mysql_real_escape_string(htmlspecialchars($_POST['zip'])); $county = mysql_real_escape_string(htmlspecialchars($_POST['county'])); $website = mysql_real_escape_string(htmlspecialchars($_POST['website'])); $map = mysql_real_escape_string(htmlspecialchars($_POST['map'])); $email = mysql_real_escape_string(htmlspecialchars($_POST['email'])); $phone = mysql_real_escape_string(htmlspecialchars($_POST['phone'])); $bhours = mysql_real_escape_string(htmlspecialchars($_POST['hours'])); $ptimes = mysql_real_escape_string(htmlspecialchars($_POST['ptime'])); $pspecials = mysql_real_escape_string(htmlspecialchars($_POST['pspecial'])); $vspecials = mysql_real_escape_string(htmlspecialchars($_POST['vspecial'])); // check that username field is filled in if ($username == '') { // generate error message $error = 'ERROR: Please fill in all required fields!'; //error, display form renderForm($id, $username, $location, $address, $city, $zip, $county, $website, $map, $email, $phone, $bhours, $ptimes, $pspecials, $vspecials, $error); } else { // save the data to the database mysql_query("UPDATE vusr SET username='$username', loc_name='$location', address='$address', city='$city', zip='$zip', county='$county', website='$website', map='$map', email='$email', phone='$phone', hours='$bhours', ptime='$ptimes', pspecial='$pspecials', vspecial='$vspecials' WHERE id='$id'") or die(mysql_error()); // once saved, redirect back to the view page header("Location: edituser.php"); } } else { // if the 'id' isn't valid, display an error echo 'Error!'; } } else // if the form hasn't been submitted, get the data from the db and display the form { // get the 'id' value from the URL (if it exists), making sure that it is valid (checing that it is numeric/larger than 0) if (isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] > 0) { // query db $id = $_GET['id']; $result = mysql_query("SELECT * FROM vusr WHERE id=$id") or die(mysql_error()); $row = mysql_fetch_array($result); // check that the 'id' matches up with a row in the databse if($row) { // get data from db $id = $row['id']; $username = $row['username']; $location = $row['loc_name']; $address = $row['address']; $city = $row['city']; $zip = $row['zip']; $county = $row['county']; $website = $row['website']; $map = $row['map']; $email = $row['email']; $phone = $row['phone']; $bhours = $row['hours']; $ptimes = $row['ptime']; $pspecials = $row['pspecial']; $vspecials = $row['vspecial']; // show form renderForm($id, $username, $location, $address, $city, $zip, $county, $website, $map, $email, $phone, $bhours, $ptimes, $pspecials, $vspecials, ''); } else // if no match, display result { echo "No results!"; } } else // if the 'id' in the URL isn't valid, or if there is no 'id' value, display an error { echo 'Error!'; } } ?> MOD EDIT: code tags added. I have all error reporting turned on. And no errors are showing. I've been staring at this code for 2 hours and can't find the error. But the form is blank! The form shows up with the radio buttons but is blank! Heres the code... <?php error_reporting(E_ALL); ?> <?php include 'dbc.php'; //----------------------------------------- $result = mysql_query("SELECT * FROM users ORDER BY nc_points DESC"); while ($row = mysql_fetch_object($result)) { $leaderboard[] = $row->user_name; $leaderboardPoints[] = $row->cfb_points; } $result1 = mysql_query("SELECT CollegeFootballGames.ID, CollegeFootballGames.Week, CollegeFootballGames.Away, CollegeFootballGames.Home, CollegeFootballTeams.Team FROM CollegeFootballGames INNER JOIN CollegeFootballTeams ON CollegeFootballGames.Away = CollegeFootballTeams.ID || CollegeFootballGames.Home=CollegeFootballTeams.ID"); while ($row = mysql_fetch_object($result1)) { $GameID[] = $row->ID; $Teams[] = $row->Team; } //---------------------------------------- $date =("now"); if ( strtotime($date) > strtotime('18 July 2010') && strtotime($date) < strtotime('2 September 2010')){$wknum = '1'; $wk = "Week";} elseif ( strtotime($date) > strtotime('6 September 2010') && strtotime($date) < strtotime('11 September 2010')){$wknum = '2'; $wk = "Week";} elseif ( strtotime($date) > strtotime('11 September 2010') && strtotime($date) < strtotime('16 September 2010')){$wknum = '3'; $wk = "Week";} elseif ( strtotime($date) > strtotime('18 September 2010') && strtotime($date) < strtotime('23 September 2010')){$wknum = '4'; $wk = "Week";} elseif ( strtotime($date) > strtotime('25 September 2010') && strtotime($date) < strtotime('2 October 2010')){$wknum = '5'; $wk = "Week";} elseif ( strtotime($date) > strtotime('2 October 2010') && strtotime($date) < strtotime('9 October 2010')){$wknum = '6'; $wk = "Week";} elseif ( strtotime($date) > strtotime('9 October 2010') && strtotime($date) < strtotime('16 October 2010')){$wknum = '7'; $wk = "Week";} elseif ( strtotime($date) > strtotime('16 October 2010') && strtotime($date) < strtotime('23 October 2010')){$wknum = '8'; $wk = "Week";} elseif ( strtotime($date) > strtotime('23 October 2010') && strtotime($date) < strtotime('28 October 2010')){$wknum = '9'; $wk = "Week";} elseif ( strtotime($date) > strtotime('30 October 2010') && strtotime($date) < strtotime('4 November 2010')){$wknum = '10'; $wk = "Week";} elseif ( strtotime($date) > strtotime('6 November 2010') && strtotime($date) < strtotime('13 November 2010')){$wknum = '11'; $wk = "Week";} elseif ( strtotime($date) > strtotime('13 November 2010') && strtotime($date) < strtotime('20 November 2010')){$wknum = '12'; $wk = "Week";} elseif ( strtotime($date) > strtotime('20 November 2010') && strtotime($date) < strtotime('27 November 2010')){$wknum = '13'; $wk = "Week";} else{} //Form 12 $form12 = ('<h3><em style="color: #F00"> <?php echo $wk;?> <?php echo $wknum;?> </em></h3> <form name="Picks" method="post" action="<?php echo $process; ?>"> <p><br> <input name="P0" type="hidden" value="<?php echo ($p[0]); ?>"> <label> <input type="radio" name="game1" value="<?php echo ($away[0]);?>" > <?php echo ($away[0]);?></label> at <label> <input type="radio" name="game1" value="<?php echo ($home[0]);?>" > <?php echo ($home[0]);?></label> <br> <input name="P1" type="hidden" value="<?php echo ($p[1]); ?>"> <label> <input type="radio" name="game2" value="<?php echo ($away[1]);?>" > <?php echo ($away[1]);?></label> at <label> <input type="radio" name="game2" value="<?php echo ($home[1]);?>" > <?php echo ($home[1]);?></label> <br> <input name="P2" type="hidden" value="<?php echo ($p[2]); ?>"> <label> <input type="radio" name="game3" value="<?php echo ($away[2]);?>" > <?php echo ($away[2]);?></label> at <label> <input type="radio" name="game3" value="<?php echo ($home[2]);?>" > <?php echo ($home[2]);?></label> <br> <input name="P3" type="hidden" value="<?php echo ($p[3]); ?>"> <label> <input type="radio" name="game4" value="<?php echo ($away[3]);?>" > <?php echo ($away[3]);?> </label> at <label> <input type="radio" name="game4" value="<?php echo ($home[3]);?>" > <?php echo ($home[3]);?></label> <input name="P4" type="hidden" value="<?php echo ($p[4]); ?>"> <br> <label> <input type="radio" name="game5" value="<?php echo ($away[4]);?>" > <?php echo ($away[4]);?></label> at <label> <input type="radio" name="game5" value="<?php echo ($home[4]);?>" > <?php echo ($home[4]);?></label> <br> <input name="P5" type="hidden" value="<?php echo ($p[5]); ?>"> <label> <input type="radio" name="game6" value="<?php echo ($away[5]);?>" > <?php echo ($away[5]);?></label> at <label> <input type="radio" name="game6" value="<?php echo ($home[5]);?>" > <?php echo ($home[5]);?></label> <br> <input name="P6" type="hidden" value="<?php echo ($p[6]); ?>"> <label> <input type="radio" name="game7" value="<?php echo ($away[6]);?>" > <?php echo ($away[6]);?></label> at <label> <input type="radio" name="game7" value="<?php echo ($home[6]);?>" > <?php echo ($home[6]);?></label> <br> <input name="P7" type="hidden" value="<?php echo ($p[7]); ?>"> <label> <input type="radio" name="game8" value="<?php echo ($away[7]);?>" > <?php echo ($away[7]);?></label> at <label> <input type="radio" name="game8" value="<?php echo ($home[7]);?>" > <?php echo ($home[7]);?></label> <br> <input name="P8" type="hidden" value="<?php echo ($p[8]); ?>"> <label> <input type="radio" name="game9" value="<?php echo ($away[8]);?>" > <?php echo ($away[8]);?> </label> at <label> <input type="radio" name="game9" value="<?php echo ($home[8]);?>" > <?php echo ($home[8]);?></label> <br> <input name="P9" type="hidden" value="<?php echo ($p[9]); ?>"> <label> <input type="radio" name="game10" value="<?php echo ($away[9]);?>" > <?php echo ($away[9]);?> </label> at <label> <input type="radio" name="game10" value="<?php echo ($home[9]);?>" > <?php echo ($home[9]);?></label> <br> <input name="P10" type="hidden" value="<?php echo ($p[10]); ?>"> <label> <input type="radio" name="game11" value="<?php echo ($away[10]);?>" > <?php echo ($away[10]);?></label> at <label> <input type="radio" name="game11" value="<?php echo ($home[10]);?>" > <?php echo ($home[10]);?></label> <br> <input name="P11" type="hidden" value="<?php echo ($p[11]); ?>"> <label> <input type="radio" name="game12" value="<?php echo ($away[11]);?>" > <?php echo ($away[11]);?></label> at <label> <input type="radio" name="game12" value="<?php echo ($home[11]);?>" > <?php echo ($home[11]);?></label> <br> <br> <label> <input type="reset" name="button" id="button" value="Reset"> </label> <label> <input type="submit" name="button2" id="button2" value="Submit"> </label> <br> </p> </form>'); if ( strtotime($date) > strtotime('18 July 2010') && strtotime($date) < strtotime('2 September 2010')){$wknum = '1'; $formDisplay = $form12; $wk = "Week"; $process = 'cfb_picks_process.php'; $away =array("$Teams[0]","$Teams[2]","$Teams[4]","$Teams[6]","$Teams[8]","$Teams[10]","$Teams[12]","$Teams[14]","$Teams[16]","$Teams[18]","$Teams[20]","$Teams[22]"); $home =array("$Teams[1]","$Teams[3]","$Teams[5]","$Teams[7]","$Teams[9]","$Teams[11]","$Teams[13]","$Teams[15]","$Teams[17]","$Teams[19]","$Teams[21]","$Teams[23]"); $p = array ("$GameID[0]","$GameID[2]","$GameID[4]","$GameID[6]","$GameID[8]","$GameID[10]","$GameID[12]","$GameID[14]","$GameID[16]","$GameID[18]","$GameID[20]","$GameID[22]");} elseif ( strtotime($date) > strtotime('6 September 2010') && strtotime($date) < strtotime('11 September 2010')){$wknum = '2';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php'; $away =array("$Teams[24]","$Teams[26]","$Teams[28]","$Teams[30]","$Teams[33]","$Teams[34]","$Teams[36]","$Teams[38]","$Teams[40]","$Teams[42]","$Teams[44]","$Teams[46]"); $home =array("$Teams[25]","$Teams[27]","$Teams[29]","$Teams[31]","$Teams[32]","$Teams[35]","$Teams[37]","$Teams[39]","$Teams[41]","$Teams[43]","$Teams[45]","$Teams[47]"); $p = array ("$GameID[24]","$GameID[26]","$GameID[28]","$GameID[30]","$GameID[32]","$GameID[34]","$GameID[36]","$GameID[38]","$GameID[40]","$GameID[42]","$GameID[44]","$GameID[46]"); } elseif ( strtotime($date) > strtotime('11 September 2010') && strtotime($date) < strtotime('16 September 2010')){$wknum = '3';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php'; $away =array("$Teams[49]","$Teams[50]","$Teams[52]","$Teams[55]","$Teams[56]","$Teams[58]","$Teams[61]","$Teams[62]","$Teams[64]","$Teams[66]","$Teams[68]","$Teams[70]"); $home =array("$Teams[48]","$Teams[51]","$Teams[53]","$Teams[54]","$Teams[57]","$Teams[59]","$Teams[60]","$Teams[63]","$Teams[65]","$Teams[67]","$Teams[69]","$Teams[71]"); $p = array ("$GameID[48]","$GameID[50]","$GameID[52]","$GameID[54]","$GameID[56]","$GameID[58]","$GameID[60]","$GameID[62]","$GameID[64]","$GameID[66]","$GameID[68]","$GameID[70]"); } elseif ( strtotime($date) > strtotime('18 September 2010') && strtotime($date) < strtotime('23 September 2010')){$wknum = '4';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php'; $away =array("$Teams[72]","$Teams[74]","$Teams[76]","$Teams[78]","$Teams[80]","$Teams[83]","$Teams[85]","$Teams[87]","$Teams[88]","$Teams[91]","$Teams[92]","$Teams[94]"); $home =array("$Teams[73]","$Teams[75]","$Teams[77]","$Teams[79]","$Teams[81]","$Teams[82]","$Teams[84]","$Teams[86]","$Teams[89]","$Teams[90]","$Teams[93]","$Teams[95]"); $p = array ("$GameID[72]","$GameID[74]","$GameID[76]","$GameID[78]","$GameID[80]","$GameID[82]","$GameID[84]","$GameID[86]","$GameID[88]","$GameID[90]","$GameID[92]","$GameID[94]"); } elseif ( strtotime($date) > strtotime('25 September 2010') && strtotime($date) < strtotime('2 October 2010')){$wknum = '5';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('2 October 2010') && strtotime($date) < strtotime('9 October 2010')){$wknum = '6';$formDisplay = $form12; $wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('9 October 2010') && strtotime($date) < strtotime('16 October 2010')){$wknum = '7';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('16 October 2010') && strtotime($date) < strtotime('23 October 2010')){$wknum = '8';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('23 October 2010') && strtotime($date) < strtotime('28 October 2010')){$wknum = '9';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('30 October 2010') && strtotime($date) < strtotime('4 November 2010')){$wknum = '10';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('6 November 2010') && strtotime($date) < strtotime('13 November 2010')){$wknum = '11';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('13 November 2010') && strtotime($date) < strtotime('20 November 2010')){$wknum = '12';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} elseif ( strtotime($date) > strtotime('20 November 2010') && strtotime($date) < strtotime('27 November 2010')){$wknum = '13';$formDisplay = $form12;$wk = "Week";$process = 'cfb_picks_process.php'; /*$away =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $home =array("$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]","$Teams[]"); $p = array ("$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]","$GameID[]"); */} else{$formDisplay = $wk = " "; $formDisplay = ("<br><br><h2>Picks For this week are final!</h2> <br><br><br> Check Back Later To Make Your Picks For Next Week");} $result = mysql_query("SELECT * FROM users ORDER BY nc_points DESC"); while ($row = mysql_fetch_object($result)) { $leaderboard[] = $row->user_name; $leaderboardPoints[] = $row->cfb_points; } $result1 = mysql_query("SELECT CollegeFootballGames.ID, CollegeFootballGames.Week, CollegeFootballGames.Away, CollegeFootballGames.Home, CollegeFootballTeams.Team FROM CollegeFootballGames INNER JOIN CollegeFootballTeams ON CollegeFootballGames.Away = CollegeFootballTeams.ID || CollegeFootballGames.Home=CollegeFootballTeams.ID"); while ($row = mysql_fetch_object($result1)) { $GameID[] = $row->ID; $Teams[] = $row->Team; } ?> <? echo $formDisplay; ?> If you see what is wrong please tell me. I did a big upgrade to my CMS and now the editing of an upload doesn't seem to work. The id is pulled from a list on the previous page and is functional. Here is the form: $id=$_GET['id']; $data = mysql_query("SELECT * FROM headerimg WHERE id = '$id'") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { echo " <div id='edit'> <form method='post' action='headerimgeditprocess.php?id=".$id ."' enctype='multipart/form-data'> <fieldset> <legend>".$info['title'] ."</legend> <table> <tr><td colspan='2' style='text-align:center'><img src='../upload/headerimg/".$info['image'] ."' width='300'><br /><br /></tr></td> <td> Title:</td> <td> <input type='text' name='title' value='".$info['title'] ."'> </td></tr> <tr><td> Image: </td><td> <input type='file' name='image'></td></tr> </table> <br/> <br/> <input TYPE='submit' name='upload' title='Add data to the Database' value='Submit'/> </fieldset> </form> Here is the processor: $target = "/var/chroot/home/content/87/6409087/html/upload/headerimg/"; //This gets all the other information from the form $title=$_POST['title']; $id=$_GET['id']; if ($image != ''){ $image = ($_FILES['image']['name']); foreach($_FILES as $file) { move_uploaded_file($file['tmp_name'], $target . $file['name']); } mysql_query("UPDATE headerimg SET image ='$image' WHERE id ='$id'"); } //Writes the information to the database mysql_query("UPDATE headerimg SET title = '$title' WHERE id ='$id' "); ?> <p>Update Successful... <a href="../main.php">click here</a> to return to the administration area.</p> it's supposed to check the file, to see if it's available for download, the code below looks okay to me, what's wrong? if($row[2]==2) // 4shared check { $row[1]="http://www.".$row[1]; $index=getpage($row[1]); preg_match("/Download ([^<]+)<\/div>/",$index,$match); if(strpos($index,"The file is shared for public access and download.")===false || !$match) { mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]); print "bad link\n"; logstr("log-c.txt","bad link\n"); } else { $words=trim($match[1]); $words=preg_split("/[_\.\-\s]/",$words); $lastword=array_pop($words); $words=implode(" ",$words); $words=preg_replace("/\s{2,}/"," ",$words); $caption=mysql_real_escape_string($words); unset($words); unset($match); preg_match("/<td>Size\:<\/td><td>([^<]+)<\/td>/",$index,$match); $fsize=$match[1]; unset($match); print "$caption :: $fsize\n"; logstr("log-c.txt","$caption :: $fsize\n"); mysql_query("UPDATE `v2links` SET `checked`='1',`lastcheck`=NOW(),`fsize`='$fsize',`caption`='$caption' WHERE `id`=".$row[0]); if(mysql_errno()) print mysql_error()."\n"; } } I'm wondering if the sharing website has changed anything, because for rapidshare it works fine, code: if($row[2]==1) // rapidshare check { $index=getpage($row[1]); if(strpos($index,"<p><script>alert(\"File not found.\")</script>File not found.</p>")===false && strpos($index,"This file has been deleted.")===false) { preg_match("/<form action=\"([^\"]+)\" method=\"post\">/",$index,$match); //print $index; if($match[1]) { $fpath=$match[1]; $index=getpage($fpath,"dl.start=Free",$row[1]); preg_match("/<\/font> \(([^\(]+)\)\.<\/p>/",$index,$match); $fsize=0; if($match[1]) $fsize=mysql_real_escape_string(strip_tags($match[1])); print $fsize."\n"; logstr("log-c.txt",$fsize."\n"); mysql_query("UPDATE `v2links` SET `checked`='1',`fsize`='$fsize',`lastcheck`=NOW() WHERE `id`=".$row[0]); if(mysql_errno()) print mysql_error()."\n"; } else { print "bad link\n"; logstr("log-c.txt","bad link\n"); mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]); if(mysql_errno()) print mysql_error()."\n"; } } else { print "bad link\n"; logstr("log-c.txt","bad link\n"); mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]); if(mysql_errno()) print mysql_error()."\n"; } } any help would be appreciated! $result3 = mysql_query("SELECT User_ID FROM leaderboards WHERE User_ID = '$user'"); if(mysql_num_rows($result3) == 0){ $query1 = "INSERT INTO leaderboards (User_ID, CollegeFootballPoints) VALUES ('$user','$points')"; $result1 = mysql_query($query1); }else{ $query2 = "UPDATE leaderboards SET CollegeFootballPoints='$points' WHERE User_ID='$user'"; $result2 = mysql_query($query2); } I keep getting this error...' Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in update_collegeFBpoints_points.php on line 40 And the script is not working! (LINE 40 is $result3 = mysql_query("SELECT User_ID FROM leaderboards WHERE User_ID = '$user'"); if(mysql_num_rows($result3) == 0){ specifically mysql_num_rows) Hello all, I'm having trouble with the following code, it's supposed to go like this, you search for a hotel, choose a room, then it takes you to confirmation page before the paypal, but the problem is, in the confirmation page, it shows everything right, the number of nights, the number of guests, all except the number of rooms, it always give me 0 rooms It's seperated into 3 files, hotelsmanager.php, bookingmanager.php, and book.php here are the codes Code: [Select] while($row = @mysql_fetch_array($result)) { echo "<tr>"; echo "<td class=\"text\" align=center>".$row['room_type']."</td>"; echo "<td class=\"text\" align=center>".$row['price_per_day']."</td>"; echo "<td class=\"text\" align=center>".$row['people']." People</td>"; echo "<td class=\"text\" align=center>"; ?> <select name="nrooms" id="nrooms" onchange=" //alert('<?php echo $row['id'] ; ?>'); //alert(this.value); var exist = 0; if(roomids.length > 0) { for(var hh = 0;hh < roomids.length; hh++) { if(roomids[hh] == <?php echo $row['id'] ; ?>) { exist = 1; //alert(hh); roomnumar[hh] = this.value; } } if(exist == 0) { roomids.push(<?php echo $row['id'] ; ?>); roomnumar.push(this.value); } } else { roomids.push(<?php echo $row['id'] ; ?>); roomnumar.push(this.value); } document.bookingform.roomid.value = roomids; document.bookingform.roomnum.value = roomnumar; "> <option value=0> 0 </option> <?php for($i = 0; $i < $row['available_rooms']; $i++) { $nr = $i+1; $pr=$nr * $row['price_per_day']; echo "<option value=$nr>$nr ($pr\$)</option>"; } echo "</select> </td>"; echo "<td align=center> </td>"; echo "</tr>"; echo "<tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr>"; } echo "<tr class=\"rooms\"> <td colspan=\"4\"> </td> <td align=center><input type=\"submit\" value=\"book\" id=\"bookroom\" name=\"bookroom\"/></td> </tr>"; echo "</table>"; echo "</form>"; print_r($_SESSION['order']); $_SESSION['order']=0; unset($_SESSION['order']); } } ?> then booking info Code: [Select] <?php include("hotelsManager.php"); ?> <?php include("config.php"); ?> <?php include("textManager.php"); ?> <?php function echoPostedData() { $dbo = new DB(); $hotelObj = new hotelManager(); $hotelID = $_POST['hotelid']; $datein = $_POST['datein']; $dateout = $_POST['dateout']; $roomid = $_POST['roomid']; $pr = $_POST['tp']; $_SESSION['hotelID'] = isset($_POST['hotelid']) ? $_POST['hotelid'] : $_SESSION['hotelID']; $_SESSION['datein'] = isset($_POST['datein']) ? $_POST['datein'] : $_SESSION['datein']; $_SESSION['dateout'] = isset($_POST['dateout']) ? $_POST['dateout'] : $_SESSION['dateout']; $_SESSION['roomid'] = isset($_POST['roomid']) ? $_POST['roomid'] : $_SESSION['roomid']; $roomsarray = explode(",",$_POST['roomid']); $_SESSION['roomsarray'] = isset($_POST['roomid']) ? explode(",",$_POST['roomid']) : $_SESSION['roomsarray']; $roonsNo = $_POST['nrooms']; $_SESSION['nrooms'] = isset($_POST['roomnum']) ? explode(",",$_POST['roomnum']) : $_SESSION['nrooms']; Then the confirmation page is Code: [Select] <?php echoPostedData(); ?> </td> </tr> <tr> <td valign="top"> </td> </tr> </table> </td> </tr> <tr> <td valign="top"><img src="images/spacer.gif" width="28" height="10" /></td> </tr> <tr> <td valign="top"> <?php if(isset($_POST['bookroom'])) {?> Hey, did something happen with the Facebook login for the phpFreaks forum recently? Been trying to log in for some time now but I kept receiving errors. Glad it's back working now!
Here is code I have, I can't seem to figure this error out, I bet it is obvious, but I clearly am not seeing it..... Here is error: Problem with the 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 '' at line 3 (not really that good of an error, but maybe help getting started?) Code: [Select] <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ www.flashbuilding.com -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['id'])) { echo 'Please <a href="login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM members WHERE userid='$userid' LIMIT 1"); while($row = mysql_fetch_array($sql)){ $name = $row["name"]; $phone = $row["phone"]; $username = $row["username"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $cell = $row["cell"]; $email = $row["email"]; $accounttype = $row["accounttype"]; $rank = $row["rank"]; $badges = $row["badges"]; } // Set error message as blank upon arrival to page $errorMsg = ""; // First we check to see if the form has been submitted if (isset($_POST['name'])){ $name = ereg_replace("[^A-Z a-z0-9]", "", $_POST['name']); // filter everything but numbers and letters $phone = ereg_replace("[^A-Z a-z0-9]", "", $_POST['phone']); // filter everything but spaces, numbers, and letters $username = ereg_replace("[^A-Z a-z0-9]", "", $_POST['username']); // filter everything but spaces, numbers, and letters $address = ereg_replace("[^A-Z a-z0-9]", "", $_POST['address']); // filter everything but spaces, numbers, and letters $city = ereg_replace("[^A-Za-z0-9]", "", $_POST['city']); // filter everything but lowercase letters $state = ereg_replace("[^A-Za-z0-9]", "", $_POST['state']); // filter everything but lowercase letters $zip = ereg_replace("[^A-Za-z0-9]", "", $_POST['zip']); // filter everything but lowercase letters $cell = ereg_replace("[^A-Za-z0-9]", "", $_POST['cell']); // filter everything but lowercase letters $accounttype = ereg_replace("[^A-Z a-z0-9]", "", $_POST['accounttype']); // filter everything but lowercase letters $email = stripslashes($_POST['email']); $email = strip_tags($email); $email = mysql_real_escape_string($email); $password = ereg_replace("[^A-Za-z0-9]", "", $_POST['password']); // filter everything but numbers and letters // Check to see if the user filled all fields with // the "Required"(*) symbol next to them in the join form // and print out to them what they have forgotten to put in if((!$name) || (!$username) || (!$password)){ $errorMsg = "You did not submit the following required information!<br /><br />"; if(!$name){ $errorMsg .= "--- Name"; } else if(!$username){ $errorMsg .= "--- Username"; } else if(!$Password){ $errorMsg .= "--- Password"; } } else { // Database duplicate Fields Check $sql_username_check = mysql_query("SELECT userid FROM members WHERE username='$username' LIMIT 1"); $username_check = mysql_num_rows($sql_username_check); if ($username_check > 0){ $errorMsg = "<u>ERROR:</u><br />Your User Name is already in use inside our system. Please try another."; } else { // Add MD5 Hash to the password variable $hashedPass = md5($password); // Add user info into the database table, claim your fields then values $sql = mysql_query("INSERT INTO members (name, phone, username, address, city, state, zip, cell, email, accounttype, password ) VALUES('$name','$phone','$username','$address','$city','$state','$zip','$cell','$email','$accounttype','$hashedPass'") or die ("Problem with the query: $sql<br>" . mysql_error()); printf("Records updated: %d\n", mysql_affected_rows()); echo mysql_error(); echo '<meta HTTP-EQUIV="REFRESH" content="3; url=http://final.net46.net/success.php">'; exit(); // Exit so the form and page does not display, just this success message } // Close else after database duplicate field value checks } // Close else after missing vars check //Close if $_POST } ?> So this appears when I try and go on my index.php...
Warning: require_once(/TZ/v3/includes/db.php) [function.require-once]: failed to open stream: No such file or directory in /home/*REMOVED*/public_html/TZ/v3/index.php on line 5 Fatal error: require_once() [function.require]: Failed opening required '/TZ/v3/includes/db.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/*REMOVED*/public_html/TZ/v3/index.php on line 5It's saying there's no file there but there is! Thanks Edited by rizmah, 14 September 2014 - 08:20 AM. mysql_query("UPDATE categories SET active=0 WHERE id=$id"); What am I doing wrong here to get: Parse error: syntax error, unexpected T_STRING ??? or should I say can you tell me WHAT is wrong? getting error on line 19 Parse error: syntax error, unexpected '[' in /home/heaven/public_html/tester/view_thread2.php on line 19 <?php include("connect.php"); mysql_select_db("heaven_forum") or die ("Could Not Select Database"); $recent = mysql_query("SELECT phpbb_posts.id AS post_id, phpbb_posts.topic_id AS topic_id, phpbb_posts.forum_id AS forum_id, phpbb_posts.poster_id AS poster_id, phpbb_topics.topic_title AS title, phpbb_users.username AS usernameFROM phpbb_posts, phpbb_topics ON phpbb_posts.topic_id=phpbb_topics.id, users ON phpbb_posts.poster_id=users.idORDER BY post_time DESC LIMIT 5"); //pull array $recent_row = mysql_fetch_assoc($recent); //set varibles pulled $topic_name = $recent ['title']; $poster = $recent['usernameFROM']; echo $topic_name; echo "Posted By: $poster"; ?> What an Earth is wrong with this code? Code: [Select] $query = "select sizes from products where id='$id'"; $result = mysql_query($query); $row = mysql_fetch_array($result); if ($row == 0) {echo "";} else {echo "Small - $row['sizes']";} PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING Code: [Select] <!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 content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Send Data Form</title> </head> <body> <?php if(!$_POST) exit; $email = $_POST['Email']; $name = $_POST['Name']; $telephone = $_POST['Telephone']; $comments = $_POST['Comments']; //$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS'; if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){ $errors=1; } if($errors==1) echo $error; else{ $values = array ('Name','Email','Telephone','Comments'); $required = array('Name','Email','Telephone','Comments'); $your_email = "****************"; $email_subject = "Comment posted from website:"; foreach($values as $key => $value){ if(in_array($value,$required)){ if ($key != 'Name' && $key != 'Comments' && $key != 'Telephone') { if( empty($_POST[$value]) ) { echo 'Please go back and complete all fields, thank you.'; exit; } } $email_content .= $value.': '.$_POST[$value]."\n"; } } } $headers = "From: $email\r\n"."Reply-To: $email\r\n".'X-Mailer: PHP/' . phpversion(); mail($your_email, $email_subject, $email_content, $headers); if($send_contact){ echo "Thank you for your submission"; } else { echo "ERROR, your comment was not sent"; ?> </body> </html> MOD EDIT: [code] . . . [/code] tags added. Hi guys (again), thanks a lot for your previous help. I'm trying to learn about conditional statements and I've tried to create a form to produce a echo statement when all the conditions are met. Below is my code, it is in two files... baconandeggs.php <html> <head></head> <body> <form action="baconandeggsform.php" method="post"> <!-- Question One --> <p>Please choose what day it is:</p> <select name="$day"> <option value="monday">Monday</option> <option value="tuesday">Tuesday</option> <option value="wednesday">Wednesday</option> <option value="thursday">Thursday</option> <option value="friday">Friday</option> <option value="saturday">Saturday</option> <option value="sunday">Sunday</option> </select> <br /> <!-- Question Two --> <p>Please enter the time:</p> <input type="$time" name="time"> <br /> <!-- Question Three --> <p>Please choose what country you are from...</p> <select name="$country"> <option value="uk">UK</option> <option value="usa">USA</option> <option value="europe">Europe</option> </select> <!-- Form Submit --> <input type="submit"> </form> </body> </html> baconandeggsform.php <html> <head></head> <body> <?php if ($day == 'thursday') { if ($time == '0800') { if ($country == 'uk') {$meal = 'bacon and eggs';} else {$meal = 'sausages';} } } ?> <?php echo $meal; ?> </body> </html> Any ideas why it isn't working? I've probably done something really obvious, but I have been trying to figure it out for a few hours now and it's doing my head in! I am trying to create a log in page but all that comes up is Please enter a username and password
<?php session_start () ; $username = $_POST ['username'] ; $password = $_POST ['passowrd'] ; if ($username&&$password) { define ('DB_HOST' , 'localhost') ; define ('DB_USER' , 'root') or die ("Could not connect!") ; define ('DB_PASSWORD', "") or die ("Could not find DB!") ; define ('DB_DATABASE', 'joke') ; } else die ("Please enter a username and password") ; $query = mysql_query ("SELECT * FROM Joke WHERE username = '$username'") ; $numrow = mysql_num_rows ($query) ; if ($numrows!=0) { //code to login While ($row= mysql_fetch_assoc($query)) { $dbusername = $row ['username'] ; $dbusername = $row ['password'] ; } //check if they match if ($username==$dbusername&&$password==$dbpassword) { echo "You're inn! <a href=member.php> Click here to enter member page" ; $_SESSION['username']=$dbusername ; } else echo "incorrect password!" ; } else die("That user does'nt exist") ; echo $numrows; ?> I am trying to create a very basic object but am having troubles. Code: [Select] <?php class item{ public $name; public $price; function __construct($name,$price){ $this->name=$name; $this->price=$price;} function getName(){ return $this->name; } } $object = new item("car",400); echo $object->getName(); ?> The HTML output is: name=$name; $this->price=$price;} function getName(){ return $this->name; } } $object = new item("car",400); echo $object->getName(); ?> I'm sure that this code is clean but for some reason will not output the desired result! any help would be great. thanks. |