wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
How do I send data from 1 page to another?
wildteen88 replied to Pi_Mastuh's topic in PHP Coding Help
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. -
I've never done that before, However I believe it'll take a look of working out. I'll see if I can come up with something.
-
How do I send data from 1 page to another?
wildteen88 replied to Pi_Mastuh's topic in PHP Coding Help
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. -
Simple PHP Problem I think ??!
wildteen88 replied to rskidorz's topic in Editor Help (PhpStorm, VS Code, etc)
Rename those files so they have a phps extension, that way we sould be able to see the source code of those files. Or save them as normal textfiles. Otherwise we cant see no source code, cant download them as it just downloads them as a blank file. -
Add a semi-colon at the end of this line: [nobbc]echo "Attempting to insert data into database<br /><br />"[/nobbc] It should be this [nobbc]echo "Attempting to insert data into database<br /><br />";[/nobbc]
-
You are using single quotes. Variables dont work within single quotes. Use double quotes.
-
How do I send data from 1 page to another?
wildteen88 replied to Pi_Mastuh's topic in PHP Coding Help
OKay try this: [code]<?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); ?>[/code] -
How do I send data from 1 page to another?
wildteen88 replied to Pi_Mastuh's topic in PHP Coding Help
looks like your mysql functions dont work. What database does your host provide you can use. Also run this: [code=php:0]<?php phpinfo(); ?>[/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. -
I think it'll go through each user in the database and update the daysold field.
-
So you get no outout what so ever. Looks like there is an error in there somewhere then. Tidied up the code a little. Try this: [code=php:0]<?php error_reporting("E_ALL"); echo "connecting to MySQL"; $db = mysql_connect("username", "db", "password") or die("Could not connect.<br /><br />" . mysql_error()); echo "connected to mysql<br /><br />"; echo "Selecting database"; mysql_select_db("fmpsite_reg", $db) or die("No database selected.<br /><br />" . mysql_error()); echo "Database selected<br /><br />"; //if(!get_magic_quotes_gpc()) // mysql_select_db("fmprotasy_reg", $con); // NOT SURE ABOUT THE ABOVE SO I COMMENTED IT OUT; echo "Attempting to insert data into database<br /><br />" $Name = mysql_real_escape_string($_POST['Name']); $Comment = mysql_real_escape_string($_POST['Comment']); $sql = "INSERT INTO `Pre` SET `Name`='".$Name."', `Team`='".$_POST['Team']."', `Rating`='".$_POST['Rating']."', `Comment`='".$Comment."'"; echo "SQL OUTPUT:<br /><code>{$sql}</code><br /><br />"; mysql_query($sql) or die('Error: ' . mysql_error()); echo "Inserted data into database"; ?>[/code]
-
Why is everyone picking out all the faults with the main site all of a sudden! All this time and now they start posting all the faults. However i think most of those faults are to with the rich text editor that is used over at the main site to generate the content. But I'm not sure. However I think the admins will thank you for adding more work to thier planned maintenance . But I think the whole site is going to be redone.
-
How do I send data from 1 page to another?
wildteen88 replied to Pi_Mastuh's topic in PHP Coding Help
OOps, forgot the L (lowercase). change [code=php:0]$row = mysq_fetch_assoc($result);[/code] to [code=php:0]$row = mysql_fetch_assoc($result);[/code] -
As many other people have requested, and you have failed to do. Post the output of [code=php:0]echo $sql;[/code] here.
-
Parse Error, unexpected $ - very fustrating. Please help.
wildteen88 replied to digi duck's topic in PHP Coding Help
Well you can start by indenting your code. This will help you working out where your { and } are supposed to go. But I have done it for you: [code]<?php header("Content-type: image/jpeg"); $name = stripslashes($_GET['name']); $size = stripslashes($_GET['size']); $font = 'images/sig_maker/fonts/'.stripslashes($_GET['font']).'.ttf'; $fontcolor['r'] = stripslashes($_GET['color_r']); // font color - RED $fontcolor['g'] = stripslashes($_GET['color_g']); // font color - GREEN $fontcolor['b'] = stripslashes($_GET['color_b']); // font color - BLUE $shadow = stripslashes($_GET['shadow']); $lines = stripslashes($_GET['lines']); function arrow($im, $x1, $y1, $x2, $y2, $alength, $awidth, $color){ /// } if(is_numeric($_GET['color']) && $_GET['color'] >= '1' && $_GET['color'] <= '27') { $bgpic = 'images/sig_maker/' . $_GET['color'] . '.jpeg'; } $im = imagecreatefromjpeg($bgpic); //Calculate, the centre: for(;;) { list($image_width, $image_height) = getimagesize($bgpic); list($left_x, , $right_x) = imagettfbbox($size, 0, $font, $name); $text_width = $right_x - $left_x; if($image_width > $text_width + 5) { break; } $size = $size - .5; if($size == 1) { die('Script not responding to decreasing font size, in other words: try using less letters.'); } } $padding = ($image_width - $text_width)/2; $textcolor = imagecolorresolve($im, $fontcolor['r'], $fontcolor['g'], $fontcolor['b']); $grey = imagecolorallocate($im, 128, 128, 128); if($shadow == 'y') { imagettftext($im, $size, 0, $padding+1, 77, $grey, $font, $name); } if($lines == 'y') { //imagettftext($im, $size, 0, $padding+1, 77, $grey, $font, $name); } imagettftext($im, $size, 0, $padding, 75, $textcolor, $font, $name); if($_GET['dl']) { imagegif($im); } ?>[/code] Notice how the code is indented. It make the code alot more readable and you can see how the code flows. Rather than having all the code in one big block. You wouldnt want to read a book that has no paragraps in it would, as it'll just be a huge block of text and you wont know here the paragaraphs start or end. The same applies to php coding, indent your code that way you know here your code blocks start and end. -
How do I send data from 1 page to another?
wildteen88 replied to Pi_Mastuh's topic in PHP Coding Help
Change this: [code]<?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); ?>[/code] To: [code]<?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); ?>[/code] Post what it returns here. Dont panic if your page doesnt display correctly, I have made it do that. -
Now I'm confused. You are running the query, see: [code]if (!mysql_query($sql)) { die('Error: ' . mysql_error()); }[/code]
-
Parse Error, unexpected $ - very fustrating. Please help.
wildteen88 replied to digi duck's topic in PHP Coding Help
Also there is no need to use the swtich statement either. Just use an if statement: [code=php:0]if(is_numeric($_GET['color']) && $_GET['color'] >= '1' && $_GET['color'] <= '27') { $bgpic = 'images/sig_maker/' . $_GET['color'] . '.jpeg'; }[/code] Also this: [code]for(;;)[/code] Is not valid. You cant have an emtpy for loop. -
Well your not performing the query if you are just echo'ing $sql. All what [code=php:0]echo $sql[/code] will do is print whats in $sql to the browser. It wont perform the query. To run the sql query you need to run it through the mysql_query function. Before you run the query you must be connected to mysql.
-
Well I havent gone into detail about using sessions/cookies. I have just brushed the surface of how to use sessions/cookies with PHP. To understand more about sessions and cookies I'd recommend that you read the manual on [url=http://php.net/session-start]sessions[/url] and [url=http://www.php.net/setcookie]setcookie[/url]. Also search google for "using sessions with PHP" and "using cookies with PHP" they should return some results. When I started using sessions I wasnt sure either. There was a good tutorial here when I was learning sessions, but I can find it.
-
How do I send data from 1 page to another?
wildteen88 replied to Pi_Mastuh's topic in PHP Coding Help
Add this: [code=php:0]$result = mysql_query($sql); $row = mysq_fetch_assoc($result); extract($row); [/code] After [code=php:0]$SQL = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'";[/code] -
Well its not the configuration, but something I should of spotted earlier. Notice you have this: [code]Options FollowSymLinks[/code] In your .htaccess That is over riding whats in your httpd.conf. Add (space)Indexes after FollowSymLinks now try going to localhost/ So you .htaccess is this: [code]RewriteEngine On Options FollowSymLinks Indexes ReWriteRule ^register_me_on_site/ register.php [L][/code]
-
How do I send data from 1 page to another?
wildteen88 replied to Pi_Mastuh's topic in PHP Coding Help
Well theres your problem. Your not running the query ($sql) at all. All you are doing is assign $sql the string "[i]SELECT * FROM myitemschibi WHERE itemID ='$itemID'[/i]" which wont do nothing. Or am I missing something here? -
Do you have a comment field in the database? If theres no comment field in the database, it wont add the commnt. Post your table structure for the table called [b]Pre[/b] here. ALso follow GingerRobots suggestion of echoing $sql, to whether the SQL query is actually correct.
-
If dont want to pay for an editor, id recommend PHP Desigber 2006. it is a free PHP IDE, comes with syntax highlighting, code hinting. Debugs your PHP scripts (requires setting up) etc. However that is only for Windows. If you wnat have an IDE for your linux box prehaps use the PHP Eclipse editor which is free, requires java though. I wouldnt recommend Dreameaver for editing your PHP scripts.