LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-09-2005, 10:33 AM   #1
xemous
Member
 
Registered: Jun 2004
Posts: 80

Rep: Reputation: 15
PHP urgent help needed!


OK! finally i update; as follows is the error and code
thanks in advance for all help!

the error:

Connecting to database: jamesgpsware
Your details are:

befoer resultResource id #3after result
Fatal error: Call to undefined function: msql_fetch_object() in /var/www/localhost/htdocs/james/status.php on line 38

the code

Code:
<html>
<head>
<title> Status Page </title>
</head>
<body>

<hr>

<?php
if (isset($_POST['action']) && $_POST['action'] == 'submitted') {

$host = "localhost";
$user = "james";
$pass = "e200";
$database = "jamesgpsware";

//Selects the database, or gives error if it cannot be found
/*$test="select * from `Customers` c, `Orders` o  WHERE c.customerID = o.Orderid";
//mebe another = after o.Orderid (o.Orderid = $usequerynum)
echo "testing: .$test"; */

echo "<strong>Connecting to database: </strong>$database <br><hr>";
$link = mysql_connect("$host", "$user", "$pass")
    or die("Could not connect : " . mysql_error());
mysql_select_db("$database") or die("Could not select database");

echo "<strong><div align=center>Your details are: <br><br>";


//select * from Customers where CustomerID = $value <-- value =

$query = "SELECT * FROM Customers WHERE Name = '$_POST[name]' OR Zip = '$_POST[zip]'";
$result = mysql_query($query) or die("Query failed : " . mysql_error());

echo "befoer result";
echo $result;
echo "after result";
while($row = msql_fetch_object($result))
{
echo $row->CustomerID;
}

echo '<table border="12">';
echo "<tr>
  <td><strong><div align=center>Customer ID</td>
  <td><strong><div align=center>Name</td>
  <td><strong><div align=center>Street</td>
  <td><strong><div align=center>City</td>
  <td><strong><div align=center>State</td>
  <td><strong><div align=center>Zip</td>
  <td><strong><div align=center>Card Type</td>
  <td><strong><div align=center>Card Holder</td>
  <td><strong><div align=center>Card #</td>
  <td><strong><div align=center>Expiry Month</td>
  <td><strong><div align=center>Expiry Year</td>
  </strong>
         </tr>";

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "\t<tr>\n";
    foreach ($line as $col_value) {
        echo "\t\t<td><div align=center>$col_value</td>\n";
    }
    echo "\t</tr>\n";
}
echo "</table>\n";

//order code here

$query2 = "SELECT * FROM Orders WHERE Orderid = $id";
$result2 = mysql_query($query2) or die("Query failed : " . mysql_error());

echo '<table border="1">';
echo "<tr>
  <td><strong><div align=center>Customer ID (dw)</td>
  <td><strong><div align=center>Order ID</td>
  <td><strong><div align=center>GoMap 1.0 Price</td>
  <td><strong><div align=center>GoMap 1.0 Qty</td>
  <td><strong><div align=center>Drive Planner 2.0 Price</td>
  <td><strong><div align=center>Drive Planner 2.0 Qty</td>
  <td><strong><div align=center>Hiker 1.0 Price</td>
  <td><strong><div align=center>Hiker 1.0 Qty</td>
  <td><strong><div align=center>G-Receiver I Price</td>
  <td><strong><div align=center>G-Receiver I Qty</td>
</tr>";


echo "\n<hr>";
echo "<br>";
echo "<strong>Customers orders: </strong>";
echo "<br><br>";
while ($line2 = mysql_fetch_array($result2, MYSQL_ASSOC)) {
    echo "\t<tr>\n";
    foreach ($line2 as $col_value2) {
        echo "\t\t<td><div align=center>$col_value2</td>\n";
    }
    echo "\t</tr>\n";
}
echo "</table>\n";

$id = mysql_fetch_row ($result);
echo $id;
//echo $id->CustomerID;

/* Free resultset */
mysql_free_result($result);

/* Closing connection */
mysql_close($link);

    echo '<pre>';
    /*print_r($_POST); this line prints the submitted stuff (array)*/
    echo '<a href="'. $_SERVER['PHP_SELF'] .'">Please try again</a><br>';
    echo '<a href="index.html">Back to Homepage</a>';
    echo '</pre>';
} else {
?>

To check your profile enter your details:<br>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    First Name:&nbsp;<input name="name" type="text" tabindex="1">&nbsp;&nbsp;&nbsp;
 Zip:&nbsp;<input name="zip" tabindex="2"><br>
    <input type="hidden" name="action" value="submitted" />
    <input type="submit" name="submit" value="submit me!" />
</form>

<?php

}

?>

<hr>

</body>
</html>

Last edited by xemous; 03-10-2005 at 07:23 AM.
 
Old 03-09-2005, 11:00 AM   #2
TheLinuxDuck
Member
 
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
Unless I'm misunderstanding, the error is a missing 'y' in the command:
PHP Code:
  while($row msql_fetch_object($result)) 
Perhaps it should be:
PHP Code:
  while($row mysql_fetch_object($result)) 
 
Old 03-10-2005, 07:27 AM   #3
xemous
Member
 
Registered: Jun 2004
Posts: 80

Original Poster
Rep: Reputation: 15
!!!
another typo

thanks alot , problem is fixed, for now....
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent - Help Needed rigel_kent Linux - General 1 07-21-2005 09:20 AM
Please Urgent Help Needed Here !!! dezeque Linux - General 6 05-26-2005 04:37 PM
Urgent Help Needed rankxeros Linux - Security 5 03-08-2004 05:32 PM
Urgent help needed the_twister Linux - Security 4 08-13-2003 10:58 AM
Urgent help needed J_Szucs Linux - Newbie 7 07-09-2002 10:39 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration