Jump to content


Photo

How do I send data from 1 page to another?


  • Please log in to reply
71 replies to this topic

#41 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 04 September 2006 - 04:04 PM

My site's www.net-petz.com/home.htm then hit login and both the username and password are test. Then hit My Inventory. That's the first page.
Schroedinger's Cat walks into a bar.
And doesn't.

#42 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 04 September 2006 - 04:16 PM

<form action=../reg/secure/itemdetails.php method=post>
<input type=hidden name='itemID' value=40>
<input type=image src=../images/details.jpg></FORM><br>

That's the html code generated. Since it clearly contains a value for itemID, either there's something wrong with the reg/secure/itemdetails.php page or there's nothing in the database where itemID is 40.

If you're certain that there is something in the database with itemID of 40 (don't assume, check it please), then there's a problem with the itemdetails.php script that's on your server right now.  Make sure that the thing is always called itemID in queries and the database etc. since all this stuff is case-sensitive.  Guess we need to see the complete code for mydetails.php exactly as it presently exists on your server if none of the above actually points you at the problem and solution.
Legend has it that reading the manual never killed anyone.
My site

#43 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 04 September 2006 - 04:20 PM

Yes, itemID 40 exists. Belongs to userID 29, itemName is spicy pepper pizza.

here's the whole itemdetails.php code:

<?
session_start();
$session=session_id( );

$itemID = $_POST['itemID'];
include ("secure/config3.php");
$SQL = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'";

		$image = str_replace(" ", "", $itemName);

		$spacedname = str_replace(" ", "%20", $itemName);
?>

<html>

<head>

<title><? print $itemName; ?></title>

</head>

<body>

<BR>
<table width="227" border="0" cellspacing="0" cellpadding="0" height="104" style="border-collapse: collapse" bordercolor="#111111">

  <tr> 

    <td height="104" valign="top" width="227" bordercolorlight="#000080"> 

      <table width="200" border="1" cellspacing="0" cellpadding="0" bgcolor="#6699FF" bordercolor="#000066">

        <tr> 

          <td align=center> 

            <table width="200" border="0" cellspacing="0" cellpadding="0">

              <tr align=center bgcolor="blue"> 

                <td align=center bgcolor="blue"> 

                  <div align="center"><font face=Arial, Helvetica, sans-serif size=3 color="blue"><b>

                    <? print "$spacedname"; ?>

                    </b></font></div>

                </td>

              </tr>

              <tr bgcolor="#FFFFFF" align="center"> 

<img src="../images/items/<?php echo $image;?>.jpg">

		
		
		<br>

              </tr>

            </table>

          </td>

        </tr>

      </table><BR>

      <table width="205" border="1" cellspacing="0" cellpadding="0" bordercolor="#000099">
        <tr> 

          <td><table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
            <tr bgcolor="#FFCCFF">
              <td height="20" colspan="2" bgcolor="#0000FF" bordercolor="navy"><div align="center">
              <font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF"><b>Item Info:</b></font></div></td>
            </tr>
            <tr>
              <td width="99" height="10" bordercolor="navy"><font face="Arial, Helvetica, sans-serif" size="1">&nbsp;Type:</font></td>
              <td width="101" height="10" bordercolor="navy"><font face="Arial, Helvetica, sans-serif" size="1"><? print "$type"; ?>
</font></td>
            </tr>
            <tr>
              <td height="19" bordercolor="navy"><font face="Arial, Helvetica, sans-serif" size="1">Use:</font></td>
              <td height="19" bordercolor="navy"><font face="Arial, Helvetica, sans-serif" size="1">&nbsp; </font>                        </tr>
          </table></td>
        </tr>
      </table><br>

    </td>

    

</table>


    

</html>

Schroedinger's Cat walks into a bar.
And doesn't.

#44 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 September 2006 - 04:24 PM

Well theres your problem. Your not running the query ($sql) at all. All you are doing is assign $sql the string "SELECT * FROM myitemschibi WHERE itemID ='$itemID'" which wont do nothing. Or am I missing something here?

#45 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 04 September 2006 - 04:26 PM

Ok. What should I put there?
Schroedinger's Cat walks into a bar.
And doesn't.

#46 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 September 2006 - 04:38 PM

Add this:
$result = mysql_query($sql);
$row = mysq_fetch_assoc($result);

extract($row);

After
$SQL = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'";


#47 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 04 September 2006 - 04:52 PM

Still doesn't work... ???
Schroedinger's Cat walks into a bar.
And doesn't.

#48 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 September 2006 - 05:11 PM

Change this:
<?php
session_start();
$session=session_id( );

$itemID = $_POST['itemID'];
include ("secure/config3.php");
$SQL = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'";

$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);

extract($row);

		$image = str_replace(" ", "", $itemName);

		$spacedname = str_replace(" ", "%20", $itemName);
?>
To:
<?php
session_start();
$session = session_id();

$itemID = $_POST['itemID'];

include ("secure/config3.php");

$SQL = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'";

$result = mysql_query($SQL);
$row = mysql_fetch_assoc($result);

echo '<pre>' . print_r($row, true) . '</pre>';

die();

$image = str_replace(" ", "", $itemName);

$spacedname = str_replace(" ", "%20", $itemName);

?>
Post what it returns here. Dont panic if your page doesnt display correctly, I have made it do that.


#49 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 04 September 2006 - 05:17 PM


Fatal error: Call to undefined function: mysq_fetch_assoc() in /homepages/20/d175171605/htdocs/reg/secure/itemdetails.php on line 12
Schroedinger's Cat walks into a bar.
And doesn't.

#50 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 September 2006 - 05:19 PM

OOps, forgot the L (lowercase). change
$row = mysq_fetch_assoc($result);
to
$row = mysql_fetch_assoc($result);


#51 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 04 September 2006 - 05:48 PM

Now it's a blank page.
Schroedinger's Cat walks into a bar.
And doesn't.

#52 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 September 2006 - 05:55 PM

looks like your mysql functions dont work. What database does your host provide you can use.

Also run this:
<?php
phpinfo();
?>

Create a file called info.php, add the above in it. Upload to your host. What does it return, post a link to output.

#53 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 04 September 2006 - 06:13 PM

http://www.net-petz....secure/info.php

I have 1and1 hosting, if that means anything to you.
Schroedinger's Cat walks into a bar.
And doesn't.

#54 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 September 2006 - 06:22 PM

OKay try this:
<?php
session_start();
$session = session_id();

$itemID = $_POST['itemID'];

include ("secure/config3.php");

$sql = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'";

$result = mysql_query($sql) or die("Unable to run query<br />" . mysql_error());

if(mysql_num_rows($result) == 1)
{
    $row = mysql_fetch_assoc($result);

    echo '<pre>' . print_r($row, true) . '</pre>';
}
else
{
    echo "Item ID '" . $itemID . "' was not found";
}

$image = str_replace(" ", "", $itemName);
$spacedname = str_replace(" ", "%20", $itemName);

?>


#55 sasa

sasa
  • Staff Alumni
  • Advanced Member
  • 2,804 posts
  • LocationHrvatska

Posted 04 September 2006 - 06:35 PM

be cereful $SQL is not same as $sql

#56 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 04 September 2006 - 07:43 PM

Unable to run query
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Schroedinger's Cat walks into a bar.
And doesn't.

#57 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 September 2006 - 10:19 PM

You have a problem with your sockets. I am not exprienced with using sockets. So I wont be able to help you much.

The only thing I can recommend you to do is read the MySQL manual on this problem.

#58 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 04 September 2006 - 10:23 PM

i don't even know what a socket is ??? ??? ???
Schroedinger's Cat walks into a bar.
And doesn't.

#59 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 04 September 2006 - 10:26 PM

It happened to me once, it has to do with a corrupted file where the socket file is suppose to be on your server.  contact your webhost, tell them it seems your sql socket file has been corrupted, this is what I did, they had to replace the file for it to connect again, I don't know if I am right or not, but I know this happened before, and I wasn't very happy about it, ask them to replace the socket file, back into the directory it's suppose to, and tell them if it's already there, to please overright it, with a new version(meaning make sure it works).

Another thing is log into your web host control panle, if it's got a double module type setup
meaning 1 place to create the database, one place to manage it, then I suggest going to where you create the database, and test it, they should have something there to test the database for bugs, if not the play this connect, and select scripts, see if you can even connect, if you can see if you can select the db, You can't ping if you aren't connected so that won't help, try also echoing mysql_error();
if someone hasn't told you to do that already, just to see if it gives a more specific error message.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#60 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 04 September 2006 - 10:27 PM

The rest of the site works though  :-\
Schroedinger's Cat walks into a bar.
And doesn't.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users