User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,700 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,172 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1271 | Replies: 15
Reply
Join Date: Mar 2007
Posts: 13
Reputation: rednarjess is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
rednarjess rednarjess is offline Offline
Newbie Poster

Question Getting Info. for specific record?

  #1  
May 2nd, 2007
Dear All;
I have table in vehicle.php file that contains vehicle information(plate number, vehicle model, reg. and exp. dates). I pprovided each record with href(more) if he want to know more about this specific vehicle in vehicle-info.php file. in vehicle-info.php I get the plateN and I pass it to the SQL command "Select * from $table where plateN = '$plateN';" However this was not working.
Can you guide me.
I attached my vehicle-info.php
Thanks alots...
Attached Files
File Type: php My-Vehicle-info.php (3.5 KB, 3 views)
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Rep Power: 5
Solved Threads: 34
Moderator
Staff Writer
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: Getting Info. for specific record?

  #2  
May 2nd, 2007
When you say it doesn't work what happens?
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote  
Join Date: Mar 2007
Posts: 13
Reputation: rednarjess is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
rednarjess rednarjess is offline Offline
Newbie Poster

Re: Getting Info. for specific record?

  #3  
May 2nd, 2007
Dear;
The SQL error that I put as acondition it occurs.
Reply With Quote  
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Rep Power: 5
Solved Threads: 34
Moderator
Staff Writer
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: Getting Info. for specific record?

  #4  
May 2nd, 2007
What is the SQL error? That error message should tell you what is wrong and point you in the right direction towards fixing it.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote  
Join Date: Mar 2007
Posts: 13
Reputation: rednarjess is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
rednarjess rednarjess is offline Offline
Newbie Poster

Re: Getting Info. for specific record?

  #5  
May 2nd, 2007
I put the condition as following
while($row = mysql_fetch_array($result));
echo"</table></div>";
}
else
echo "<p><i><b><font face=\"Chiller\" size=\"6\" color=\"#FF0000\">Sorry dear</font><font face=\"Chiller\" size=\"5\" color=\"#800000\">,
there is may be an error in our system, please contact us.</font></b></i></p>";
Reply With Quote  
Join Date: Dec 2006
Location: syria
Posts: 157
Reputation: w_3rabi is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 8
w_3rabi's Avatar
w_3rabi w_3rabi is offline Offline
Junior Poster

Re: Getting Info. for specific record?

  #6  
May 2nd, 2007
what does this page output as an error??
Reply With Quote  
Join Date: Mar 2007
Posts: 13
Reputation: rednarjess is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
rednarjess rednarjess is offline Offline
Newbie Poster

Re: Getting Info. for specific record?

  #7  
May 2nd, 2007
Sorry dear,
there is may be an error in our system, please contact us.
Reply With Quote  
Join Date: Sep 2006
Location: Canada
Posts: 55
Reputation: GliderPilot is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
GliderPilot's Avatar
GliderPilot GliderPilot is offline Offline
Junior Poster in Training

Re: Getting Info. for specific record?

  #8  
May 2nd, 2007
I took a look at the code and the only things I can see is to check the spelling (case sensitive) of the Index in your $_GET array.

Personally I would change the if statement. check if your result variable contains any data, and move your fetch array down into the if block. Than add a mysql_error(); to your error at the end. This way if your query fails it will tell you what happened so you can fix it. As well I would enclose the code of your else statement in { and } to ensure proper processing. Otherwise evan when it works it will possibly show your error.

I.E.

 
$result = mysql_query($sql);
 
if ($result)
{
  $row = mysql_fetch_array($result);
 
  ... (Rest of code)
 
}
else
{
 
  ...error code here...
 
  mysql_error();
 
}
 

After you do that if you still have errors, they should be more detailed and we will be able to help you out furthur.
Last edited by GliderPilot : May 2nd, 2007 at 10:55 am.
Reply With Quote  
Join Date: Mar 2007
Posts: 13
Reputation: rednarjess is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
rednarjess rednarjess is offline Offline
Newbie Poster

Re: Getting Info. for specific record?

  #9  
May 2nd, 2007
The problem now, that I can't view specific info. for specific record.
I wrote
$plateN = $_GET["PlateN"];
$sql = "SELECT * from $table where plateN='$plateN'";

But it does not retriev any data from my DB!
Reply With Quote  
Join Date: Sep 2006
Location: Canada
Posts: 55
Reputation: GliderPilot is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
GliderPilot's Avatar
GliderPilot GliderPilot is offline Offline
Junior Poster in Training

Re: Getting Info. for specific record?

  #10  
May 2nd, 2007
If you echo $plateN what do you get?? Is it blank?
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 2:41 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC