monkeybidz Posted November 11, 2007 Share Posted November 11, 2007 The following code only gets user and title from database, but does not get the rest. They do exsist in database. $query = "select * from PHPAUCTIONREVERSE_auctions where id=".intval($_REQUEST[id]); $result = mysql_query($query); if ( !$result ) { print "aki 3"; exit; MySQLError($query); exit; } $user = stripslashes(mysql_result ( $result, 0, "user" )); $title = stripslashes(mysql_result ( $result, 0, "title" )); $origin_zip = mysql_result($result, 0, "origin_zip"); $destination_zip = mysql_result ( $result, 0, "destination_zip" ); $pickup_date = mysql_result ( $result, 0, "pickup_date" ); $delivery_date = mysql_result ( $result, 0, "delivery_date" ); $origin_type = mysql_result ( $result, 0, "origin_type" ); $destination_type = mysql_result ( $result, 0, "destination_type" ); $city_details1 = mysql_result( $result, 0, "city_details1" ); $state1 = mysql_result ( $result, 0, "state1" ); $city_details2 = mysql_result ( $result, 0, "city_details2" ); $state2 = mysql_result ( $result, 0, "state2" ); $miles = mysql_result ( $result, 0, "miles" ); Link to comment https://forums.phpfreaks.com/topic/76827-solved-query-does-not-get-variable-from-db/ Share on other sites More sharing options...
PHP_PhREEEk Posted November 11, 2007 Share Posted November 11, 2007 Please, after 165 posts, could you please use the BBCode format for posting code? Anyways, try this and post the results: $query = "select * from PHPAUCTIONREVERSE_auctions where id=".intval($_REQUEST[id]); $result = mysql_query($query); if ( !$result ) { print "aki 3"; exit; MySQLError($query); exit; } $row = mysql_fetch_array($result); echo "<pre>"; print_r($row); die("</pre>"); PhREEEk Link to comment https://forums.phpfreaks.com/topic/76827-solved-query-does-not-get-variable-from-db/#findComment-388964 Share on other sites More sharing options...
monkeybidz Posted November 11, 2007 Author Share Posted November 11, 2007 That only gave me full print of the entire row in my php page. My php page includes an html page. I just need to get the variable from db and print in html page. Link to comment https://forums.phpfreaks.com/topic/76827-solved-query-does-not-get-variable-from-db/#findComment-388969 Share on other sites More sharing options...
PHP_PhREEEk Posted November 11, 2007 Share Posted November 11, 2007 You said only user and title is returned. I posted code to see exactly what all is being pulled. If it's all there, then do this: $row = mysql_fetch_array($result); $user = stripslashes($row['user']); $title = stripslashes($row['title']); $origin_zip = $row['origin_zip']; $destination_zip = $row['destination_zip']; etc, etc... PhREEEk Link to comment https://forums.phpfreaks.com/topic/76827-solved-query-does-not-get-variable-from-db/#findComment-388973 Share on other sites More sharing options...
monkeybidz Posted November 11, 2007 Author Share Posted November 11, 2007 I tried that already, but when I add the following code to the html include page to echo or print the variable, I get nothing. User and title print fine. <? print $city_details1; ?> Link to comment https://forums.phpfreaks.com/topic/76827-solved-query-does-not-get-variable-from-db/#findComment-388977 Share on other sites More sharing options...
PHP_PhREEEk Posted November 11, 2007 Share Posted November 11, 2007 Well, at this point then, we go to the obvious. post the code... PhREEEk Link to comment https://forums.phpfreaks.com/topic/76827-solved-query-does-not-get-variable-from-db/#findComment-388978 Share on other sites More sharing options...
monkeybidz Posted November 11, 2007 Author Share Posted November 11, 2007 DOPE!!!!! There was nothing wrong, turns out I added the new fields to DB after items had already been inserted to DB. Last input was ID 19. When I tried to look at that item on site, the information did not exsist for this item, but when I looked at all newer items ID's 20 and up everything looks good. By the way your code also worked when viewing the updated items. Thanks for your help. Link to comment https://forums.phpfreaks.com/topic/76827-solved-query-does-not-get-variable-from-db/#findComment-388981 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.