Pi_Mastuh Posted September 4, 2006 Author Share Posted September 4, 2006 Now it's a blank page. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-85897 Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 looks like your mysql functions dont work. What database does your host provide you can use.Also run this:[code=php:0]<?phpphpinfo();?>[/code]Create a file called info.php, add the above in it. Upload to your host. What does it return, post a link to output. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-85900 Share on other sites More sharing options...
Pi_Mastuh Posted September 4, 2006 Author Share Posted September 4, 2006 http://www.net-petz.com/reg/secure/info.phpI have 1and1 hosting, if that means anything to you. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-85905 Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 OKay try this:[code]<?phpsession_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);?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-85906 Share on other sites More sharing options...
sasa Posted September 4, 2006 Share Posted September 4, 2006 be cereful $SQL is not same as $sql Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-85914 Share on other sites More sharing options...
Pi_Mastuh Posted September 4, 2006 Author Share Posted September 4, 2006 Unable to run queryCan't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-85943 Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 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 [url=http://dev.mysql.com/doc/refman/5.0/en/can-not-connect-to-server.html]MySQL manual[/url] on this problem. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86034 Share on other sites More sharing options...
Pi_Mastuh Posted September 4, 2006 Author Share Posted September 4, 2006 i don't even know what a socket is ??? ??? ??? Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86039 Share on other sites More sharing options...
Ninjakreborn Posted September 4, 2006 Share Posted September 4, 2006 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 setupmeaning 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. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86041 Share on other sites More sharing options...
Pi_Mastuh Posted September 4, 2006 Author Share Posted September 4, 2006 The rest of the site works though :-\ Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86042 Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 Does the rest of the site use a mysql database? My code shouldn't affect your mysql connection. Whats in secure/config3.php is this where you connect to the database? Check that you have the correct information for connecting to mysql in that file. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86077 Share on other sites More sharing options...
Pi_Mastuh Posted September 5, 2006 Author Share Posted September 5, 2006 Config 3 is [code]<?include ("htm/siteinfo.htm"); //connection informationinclude ("dbinfo.php");//end connection information $SQL = "SELECT * FROM chibifriends WHERE preuserID = '$preuserID'"; $result = mysql_query($SQL,$connection); $query_data = mysql_fetch_array($result); $preuserID = $query_data['preuserID']; $points = $query_data['preuserDigitalCredits'];?>[/code]The connection info is in dbinfo. Which is:[code]<?//connection information$db_name = "db175253437";$table_name = "chibifriends";$connection =mysql_connect("db491.perfora.net", "dbo175253437" ,"**********") or die("Couldn't connect");$db = mysql_select_db($db_name, $connection) or die("Couldn't select Database1.");$connection2 = $connection;?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86098 Share on other sites More sharing options...
wildteen88 Posted September 5, 2006 Share Posted September 5, 2006 Try this:[code]<?phpsession_start();$session = session_id();$itemID = $_POST['itemID'];include ("secure/config3.php");$sql = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'";$result = mysql_query($sql, $connection) or die("Unable to run query<br />" . mysql_errno($connection) . ': ' . mysql_error($connection));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);?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86277 Share on other sites More sharing options...
Pi_Mastuh Posted September 5, 2006 Author Share Posted September 5, 2006 Unable to run query: Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86663 Share on other sites More sharing options...
wildteen88 Posted September 5, 2006 Share Posted September 5, 2006 What the hell! This is some weird c**pRather than including the database stuff. Try this:[code]<?php//session_start();//$session = session_id();$db_name = "db175253437";$conn = mysql_connect("db491.perfora.net", "dbo175253437" ,"**********", true) or die("Couldn't connect");mysql_select_db($db_name, $conn) or die("Couldn't select Database1.");$itemID = $_POST['itemID'];$sql = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'";$result = mysql_query($sql, $conn) or die("Unable to run query - <code>{$sql}</code><br />" . mysql_error($conn));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";}?>[/code]Make sure you change where it says ********** with your actual mysql password. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86723 Share on other sites More sharing options...
Pi_Mastuh Posted September 6, 2006 Author Share Posted September 6, 2006 It shows this above the blank table:Array( [itemID] => 40 [userID] => 29 [petID] => 0 [itemName] => Spicy Pepper Pizza [itemQty] => 1 [petPointsValue] => 0 [itemStoreID] => 1579 [food] => 0) Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86825 Share on other sites More sharing options...
wildteen88 Posted September 6, 2006 Share Posted September 6, 2006 The code is now working! For some reason it wasnt connecting to the database when you was including config3.phpSo all you need to do now is put in the relevent HTML/PHP code in to display the page correctly. Which I think is this:[code]<?phpsession_start();$session = session_id();$db_name = "db175253437";$conn = mysql_connect("db491.perfora.net", "dbo175253437" ,"**********", true) or die("Couldn't connect");mysql_select_db($db_name, $conn) or die("Couldn't select Database1.");$itemID = $_POST['itemID'];$sql = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'";$result = mysql_query($sql, $conn) or die("Unable to run query - <code>{$sql}</code><br />" . mysql_error($conn));if(mysql_num_rows($result) == 1){ $row = mysql_fetch_assoc($result); $image = str_replace(" ", "", $row['itemName']); $spacedname = str_replace(" ", "%20", $row['itemName']);}else{ die("Item Id " . $itemID . " was not found");}?><html><head><title><?php 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><?php 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"> Type:</font> </td> <td width="101" height="10" bordercolor="navy"> <font face="Arial, Helvetica, sans-serif" size="1"><?php 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"> </font> </td> </tr> </table> </td> </tr> </table> <br> </td> </tr></table></body></html>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86844 Share on other sites More sharing options...
Pi_Mastuh Posted September 6, 2006 Author Share Posted September 6, 2006 Yes! Cept the only thing is that the name shows up as Spicy%20Pepper%20Pizza instead of Spicy Pepper Pizza. What's the corrdect code for spaces? Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86853 Share on other sites More sharing options...
wildteen88 Posted September 6, 2006 Share Posted September 6, 2006 You have coded it to do that. What you'll want to do is change[code=php:0]$spacedname = str_replace(" ", "%20", $row['itemName']);[/code]to:[code=php:0]$itemName = $row['itemName'];[/code]Now find[code]<font face="Arial, Helvetica, sans-serif" size="3" color="blue"><b><?php print $spacedname; ?></b></font>[/code]Change that to this:[code]<font face="Arial, Helvetica, sans-serif" size="3" color="blue"><b><?php print $itemName; ?></b></font>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86855 Share on other sites More sharing options...
Pi_Mastuh Posted September 6, 2006 Author Share Posted September 6, 2006 Now the name doesnt show up at all :-\ Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86859 Share on other sites More sharing options...
wildteen88 Posted September 6, 2006 Share Posted September 6, 2006 man your site is wierd. Try this:[code]<?phpsession_start();$session = session_id();$db_name = "db175253437";$conn = mysql_connect("db491.perfora.net", "dbo175253437" ,"**********", true) or die("Couldn't connect");mysql_select_db($db_name, $conn) or die("Couldn't select Database1.");$itemID = $_POST['itemID'];$sql = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'";$result = mysql_query($sql, $conn) or die("Unable to run query - <code>{$sql}</code><br />" . mysql_error($conn));if(mysql_num_rows($result) == 1){ $row = mysql_fetch_assoc($result); $image = str_replace(" ", "", $row['itemName']); $itemName1 = $row['itemName'];}else{ die("Item Id " . $itemID . " was not found");}?><html><head><title><?php echo $itemName1; ?></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> <font face="Arial, Helvetica, sans-serif" size="3" color="white"><b><?php echo $itemName1; ?></b></font> </td> </tr> <tr bgcolor="#FFFFFF" align="center"> <td><img src="../images/items/<?php echo $image; ?>.jpg"></td> </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"> Type:</font> </td> <td width="101" height="10" bordercolor="navy"> <font face="Arial, Helvetica, sans-serif" size="1"><?php echo $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"> </font> </td> </tr> </table> </td> </tr> </table> <br> </td> </tr></table></body></html>[/code]If it dont show the name I dont know. :( Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86865 Share on other sites More sharing options...
.josh Posted September 6, 2006 Share Posted September 6, 2006 [quote=Pi_Mastuh]Got it! thank you so much! I have one more question..[/quote]Pi_Mastuh, since you said the problem is fixed, and you have asked a new question, I think the wisest thing here would be to close this thread and start a new thread. I took the liberty of splitting this thread and making a new thread out of your post (the post where you said this problem was solved). You can see it here:http://www.phpfreaks.com/forums/index.php/topic,107050.0.html Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/3/#findComment-86898 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.