wmguk Posted August 21, 2007 Share Posted August 21, 2007 Hmm, im trying to do a simple query to a database and then show the results in a form.. <?php include "../scripts/connection.php"; if (!$con) { die( 'Could not connect: ' . mysql_error() ); } mysql_select_db($db, $con); $sql = "SELECT * FROM album WHERE login = '$login'"; $result = mysql_query( $sql ) or die( "<strong>Query Error</strong>: " . mysql_error() . "<br><strong>Query</strong>: $sql<br><br>" ); $row = mysql_fetch_assoc($result); $active = $row['active']; $login = $row['login']; $pass = $row['password']; $ceremony = $row['ceremony']; $bride_firstname = $row['bride_firstname']; $bride_surname = $row['bride_surname']; $groom_firstname = $row['groom_firstname']; $groom_surname = $row['groom_surname']; $date_day = $row['date_day']; $date_month = $row['date_month']; $date_year = $row['date_year']; $venue = $row['venue']; $email = $row['email']; $image_no = $row['image_no']; $pricing = $row['pricing']; $postage = $row['postage']; $loginlower = strtolower($login); ?> <?php echo $venue ; ?> however this doesnt display the result. any ideas? Link to comment https://forums.phpfreaks.com/topic/66051-solved-simple-query-problem/ Share on other sites More sharing options...
BlueSkyIS Posted August 21, 2007 Share Posted August 21, 2007 is $venue the only value not coming out? if so, make sure 1. you have the right spelling of the database field, and 2. there is data in that field. Link to comment https://forums.phpfreaks.com/topic/66051-solved-simple-query-problem/#findComment-330327 Share on other sites More sharing options...
wmguk Posted August 21, 2007 Author Share Posted August 21, 2007 nope, its all the values, Link to comment https://forums.phpfreaks.com/topic/66051-solved-simple-query-problem/#findComment-330332 Share on other sites More sharing options...
akitchin Posted August 21, 2007 Share Posted August 21, 2007 then you're likely not returning any rows with that query. try checking what mysql_num_rows() returns: <?php include "../scripts/connection.php"; if (!$con) { die( 'Could not connect: ' . mysql_error() ); } mysql_select_db($db, $con); $sql = "SELECT * FROM album WHERE login = '$login'"; $result = mysql_query( $sql ) or die( "<strong>Query Error</strong>: " . mysql_error() . "<br><strong>Query</strong>: $sql<br><br>" ); echo 'the query found '.mysql_num_rows($result).' rows.'; ?> Link to comment https://forums.phpfreaks.com/topic/66051-solved-simple-query-problem/#findComment-330333 Share on other sites More sharing options...
wmguk Posted August 21, 2007 Author Share Posted August 21, 2007 man, again its been such a long day!!! what a dumb problem to get... at the top of the page $_GET and $_POST .... i used the wong one!!! its sorted now, thank you Link to comment https://forums.phpfreaks.com/topic/66051-solved-simple-query-problem/#findComment-330337 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.