plz urgent urgent urgent help plz

Reply

Join Date: Jun 2007
Posts: 12
Reputation: gavy is an unknown quantity at this point 
Solved Threads: 0
gavy gavy is offline Offline
Newbie Poster

plz urgent urgent urgent help plz

 
0
  #1
Jun 3rd, 2007
i started the application to build upon and came to an error, i tried to figure it out but through different procedure here is what i am calling:

print ("<tr><td><a href=morder.php");
print ("?p_id=");
print($row['id']);
print(">");
print($row['p_name']);
print("</a></td>");

it is calling the id from database, the link shows properly the values of the id as 1,2 etc, now when i clik the link the value is not passed as: NULL


this is te error


SELECT * FROM catalog WHERE id=
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in C:\wamp\www\PPP_Cart\morder.php on line 63

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in C:\wamp\www\PPP_Cart\morder.php on line 64

this is the code:

$query2="SELECT * FROM catalog WHERE id=$p_id";
echo "$query2";

plz help me thanks asap
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 437
Reputation: Fungus1487 is on a distinguished road 
Solved Threads: 50
Fungus1487's Avatar
Fungus1487 Fungus1487 is offline Offline
Posting Pro in Training

Re: plz urgent urgent urgent help plz

 
0
  #2
Jun 3rd, 2007
your links wrong to start with

  1.  
  2. print ("<tr><td><a href\"=morder.php");
  3. print ("?p_id=");
  4. print($row['id']);
  5. print("\">");
  6. print($row['p_name']);
  7. print("</a></td>");


what is $p_id a number or a string ?
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 437
Reputation: Fungus1487 is on a distinguished road 
Solved Threads: 50
Fungus1487's Avatar
Fungus1487 Fungus1487 is offline Offline
Posting Pro in Training

Re: plz urgent urgent urgent help plz

 
0
  #3
Jun 3rd, 2007
woops i mean

  1. print ("<tr><td><a href=\"morder.php");
  2. print ("?p_id=");
  3. print($row['id']);
  4. print("\">");
  5. print($row['p_name']);
  6. print("</a></td>");
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 12
Reputation: gavy is an unknown quantity at this point 
Solved Threads: 0
gavy gavy is offline Offline
Newbie Poster

Re: plz urgent urgent urgent help plz

 
0
  #4
Jun 3rd, 2007
the id passed is the primary key of table quite obious it is int value. also you specified the / in the above code of mine, i changed it but it does not work, you said

what is $p_id a number or a string ?

$p_id is the variable created to fetch the id from the query as

$q1="SELECT * FROM catalog";
$r1=mysql_query($q1);
while($row=mysql_fetch_array($r1))
{
print ("<tr><td><a href=morder.php");
print ("?p_id=");
print ($row['id']);
print (">");
print ($row['p_name']);
print ("</a></td></tr>");
}
Last edited by gavy; Jun 3rd, 2007 at 11:42 pm.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 437
Reputation: Fungus1487 is on a distinguished road 
Solved Threads: 50
Fungus1487's Avatar
Fungus1487 Fungus1487 is offline Offline
Posting Pro in Training

Re: plz urgent urgent urgent help plz

 
0
  #5
Jun 4th, 2007
you have to use the escape "\" when entering a " qoutation mark inside a string otherwise it will close the string and you cant write a link without using a qoutation mark i.e.

<A href="...">somwehere</A>

otherwise i dont see how you could link it in the first place ?

and it is a backslash \
not a forward slash /
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 12
Reputation: gavy is an unknown quantity at this point 
Solved Threads: 0
gavy gavy is offline Offline
Newbie Poster

Re: plz urgent urgent urgent help plz

 
0
  #6
Jun 4th, 2007
well here is what is caused as an error:

$q2 = "SELECT * FROM catalog WHERE id='$p_id'";
$r2 = mysql_query($q2);
$p_name = mysql_result($r2, 0, "p_name");

now the error is:

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 1 on MySQL result index 5 in C:\wamp\www\PPP_Cart\morder.php on line 82
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 437
Reputation: Fungus1487 is on a distinguished road 
Solved Threads: 50
Fungus1487's Avatar
Fungus1487 Fungus1487 is offline Offline
Posting Pro in Training

Re: plz urgent urgent urgent help plz

 
0
  #7
Jun 4th, 2007
hmmm i dont see what is actually going wrong. why not print out everything the result returns and see if that works then move on from there ?

  1. while ($row=mysql_fetch_array($r2)){
  2. foreach ($row as $value) {
  3. print($value + "<br>");
  4. }
  5. }
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 12
Reputation: gavy is an unknown quantity at this point 
Solved Threads: 0
gavy gavy is offline Offline
Newbie Poster

Re: plz urgent urgent urgent help plz

 
0
  #8
Jun 4th, 2007
here it is what i am trying to do?

<?php
$query1 = "SELECT * FROM catalog";
$result1 = mysql_query($query1);
while ($row = mysql_fetch_array($result1))
{
print ("<tr><td><a href=morder.php");
print ("?p_id=");
print ($row['id']);
print (">");
print ($row['p_name']);
print ("</a></td></tr>");
}
?>

in the above code calling the value from catalog which consist of id, p_name etc fields

now

<?php
$q2 = "SELECT * FROM catalog WHERE id='$p_id'";
$r2 = mysql_query($q2);
$p_name = mysql_result($r2, 0, "p_name");
echo "<br>";
echo "$p_name";

the value of the $p_pid shows when i move the mouse over in the status bar correctly but when i clik it

the query is passed as:

select * from catalog where p_id='';

no value being passed.
Last edited by gavy; Jun 4th, 2007 at 9:11 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 2
Reputation: jigendaisuke is an unknown quantity at this point 
Solved Threads: 0
jigendaisuke jigendaisuke is offline Offline
Newbie Poster

Re: plz urgent urgent urgent help plz

 
0
  #9
Jun 5th, 2007
You should use this instead:
$q2 = "SELECT * FROM catalog WHERE id='".$_REQUEST["p_id"]."'";

FOr the link printing:
echo "<tr><td>";
echo "<a href=morder.php?p_id=".$row['id'].">".$row['p_name'];
echo ("</a></td></tr>");
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC