Welcome visitor
* Login
* Register
It is currently July 15th, 2019, 8:11 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Server Side » PHP



Post new topic Reply to topic  [ 5 posts ] 
Author Message
  Help to use a mysql database with php
PostPosted: November 4th, 2009, 6:18 am 

Posts: 27
This is my first time using PHP and MySQL, and probably the last one. Ahhh...

I'd been doing copy&paste all the way through but i got to a point where i get no errors but page stays white and no results are on the screen, This is my code (where I'm stuck)

<?php
extract($_GET);
$con = mysql_connect("localhost","admon","labase");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("table_properities", $con);

$result = mysql_query("SELECT * FROM Sales
WHERE ID='$id'") or die (mysql_error());

$row = mysql_fetch_array ( $result );
echo $row['description']." - ".$row['bonus'];
?>

Any help is highly appreciated.


Top
 Profile  
 
  Re: Help to use a MySQL database with PHP
PostPosted: November 4th, 2009, 6:23 am 
User avatar

Posts: 79
Try this line after the array is fetched
print_r($row);
let me know what happens, this is to make sure that $row isn't empty and is retrieving your database info.


Top
 Profile  
 
  Re: Help to use a MySQL database with PHP
PostPosted: November 4th, 2009, 6:29 am 

Posts: 27
first, thank you for your quick answer


Well, I dont know if this is right, it looks weird for me
Quote:
13Array ( [0] => 13 [ID] => 13 [1] => test1[Label] => test1[2] => just a test[Description] => just a test[3] => upload/help.gif [Pic1] => upload/help.gif [4] => [Pic2] => [5] => [Pic3] => [6] => [Bonus] => [7] => [Map] => ) -


Top
 Profile  
 
  Re: Help to use a MySQL database with PHP
PostPosted: November 4th, 2009, 6:40 am 
User avatar

Posts: 79
Caps should match
use Description instead of description
and Bonus instead of bonus


Top
 Profile  
 
  Re: Help to use a MySQL database with PHP
PostPosted: November 4th, 2009, 6:42 am 

Posts: 27
:mrgreen: Thanks a lot man! Now I can go to sleep!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

FORUMS » Server Side » PHP


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron