| | |
plz urgent urgent urgent help plz
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2007
Posts: 12
Reputation:
Solved Threads: 0
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
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
your links wrong to start with
what is $p_id a number or a string ?
PHP Syntax (Toggle Plain Text)
print ("<tr><td><a href\"=morder.php"); print ("?p_id="); print($row['id']); print("\">"); print($row['p_name']); 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
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
woops i mean
PHP Syntax (Toggle Plain Text)
print ("<tr><td><a href=\"morder.php"); print ("?p_id="); print($row['id']); print("\">"); print($row['p_name']); print("</a></td>");
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
•
•
Join Date: Jun 2007
Posts: 12
Reputation:
Solved Threads: 0
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>");
}
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.
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 /
<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
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
•
•
Join Date: Jun 2007
Posts: 12
Reputation:
Solved Threads: 0
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
$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
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 ?
PHP Syntax (Toggle Plain Text)
while ($row=mysql_fetch_array($r2)){ foreach ($row as $value) { print($value + "<br>"); } }
When Autumn Falls [ http://www.whenautumnfalls.co.uk ] &&
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
Designdotworks [ http://www.designdotworks.co.uk ] Web / Graphic / Software Design
•
•
Join Date: Jun 2007
Posts: 12
Reputation:
Solved Threads: 0
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.
<?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.
![]() |
Similar Threads
- Plz very urgent (ASP.NET)
- PLz its very urgent. (ASP)
- outlook 2003 and exchange 2003 - urgent issues - very urgent...??? (Windows Software)
- URGENT!: Saving Database information from ASP.NET Button (ASP.NET)
- input from file into class (C++)
- Urgent.....Dynamic Changes.... (JavaScript / DHTML / AJAX)
- How do I access variables in my queue? (C++)
Other Threads in the PHP Forum
- Previous Thread: Circular calls
- Next Thread: How to insert newline character
| Thread Tools | Search this Thread |
.htaccess alerts apache api archive array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database dataentry date display duplicates dynamic echo email emptydisplayvalue error execute explodefunction file files firstoptioninphpdroplist folder form forms function functions google hack href htaccess html htmlspecialchars image include insert ip javasciptvalidation javascript joomla keywords limit link login mail matching menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect remote script search securephp server sessions shot sms source space sql subscription syntax system table tutorial tutorials update upload url validator variable video web youtube





