wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
What do you want to happen when the user clicks the link? You really are pushing your limit.
-
I have already have shown you! DO you understand any of the code used? If you dont then you should read the PHP manual.
-
Sorry made a mistake in my code echo 'Your have requested ID #'.$GET['id'].'<br />'; Needs to be echo 'Your have requested ID #'.$_GET['id'].'<br />';
-
remowe one ' after = after click link in variable $_GET['id'] is value of id where i put this code No need to do that, I have already fixed that.
-
Check Apaches error log. The error will be logged there. Alternatively turn display_errors on and set error_reporting to E_ALL
-
You need to add more code to display a new page, eg <?php $con = mysql_connect("localhost","apnimusk","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("apnimusk_naat", $con); // check to see if id is set if(isset($_GET['id']) && is_numeric($_GET['id'])) { echo 'Your have requested ID #'.$GET['id'].'<br />'; echo '<a href="sadasdas.php">Back</a>'; } // no id requested, display results else { $result = mysql_query("SELECT * FROM album"); while($row = mysql_fetch_assoc($result)) { echo '<a href="?id='.$row['id'].'">'.$row['age'].'</a> - ' . $row['name'] . " - " . $row['age'] . '<br />'; } } mysql_close($con); ?>
-
Change echo "<a href='?id='".$row['id']."'>".$row['age']."</a><br />'"; to echo '<a href="?id='.$row['id'].'">'.$row['age'].'</a><br />';
-
Change your code to <?php $con = mysql_connect("localhost","apnimusk","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("apnimusk_naat", $con); $result = mysql_query("SELECT * FROM album"); while($row = mysql_fetch_assoc($result)) { echo "<pre>".print_r($row, true)."</pre>"; echo $row['name'] . " " . $row['age']; echo "<a href='?id='".$row['id']."'>".$row['age']."</a><br />'"; } mysql_close($con); ?> And post the output here.
-
The variable $row['id'] corresponds to the id field in your album table, What field do you to be part of your link?
-
That code does create a hyperlink! I understand you want to create a link which links to http://www.apnimuskaan.com/sadasdas.php?id= however what I dont understand is what you want ?id= set to? You need to change $row['id'] to whatever you want the ?id= set to.
-
Set index as the default controller, (which it should be by default). mysite.com/index or mysite.com/about will call mysite.com/index/index or mysite.com/index/about
-
Thread locked, do not double post. http://www.phpfreaks.com/forums/index.php/topic,213415.msg973292.html#msg973292
-
It does come with PHP yes. However in order use GD you must enable the extension, you do this by finding the following line within the php.ini ;extension=php_gd2.dll remove the semi-colon ( ; ) at the beginning of the line and save the php.ini and then restart Apache. NOTE: Make sure the extension_dir directive is setup correctly, this directive should be set to PHP's extension folder. Example: extension_dir = "C:/php/ext"
-
As you're doing the same thing on each $_POST variable, I'd change your code to <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Free Test</title> </head> <body><?php // get posted data into local variables $EmailFrom = "[email protected]"; $EmailTo = "[email protected]"; $Subject = "Free Test Submission"; $fields = array('Name', 'Email', '1AConservative', '1BLabour', '1CLiberalDemocrat', '1DGreenParty', '2AQueenElizabeth1', '2BQueenElizabeth2', '2CQueenAnne1', '3AUK2', '3BUK4', '3CUK3', '3DUK1', '4ACarmarthen', '4BCardiff', '4CLondon', '4DDublin', '5AGordonBrown', '5BTonyBlair', '5CDavidCameron', '5DDavidMilliband', '6AStPatrick', '6BStGeorge', '6CStAndrew', '7AStGeorge', '7BStDavid', '7CStAndrew', '8ANaturalHealthService', '8BNationalHealthService', '8CNationalHealthSupply', '9A4Years', '9B5Years', '9C6Years', '10A15Years', '10B16Years', '10C18Years', '11AKingCharles', '11BPrinceCharles', '11CKingPhillip', '11DPrincePhillip', '12A11October', '12B11November', '12C1May', '12D3September', '13ARealCatholic', '13BRomanChristian', '13CRomanCatholic', '14A60Mph', '14B70Mph', '14C80Mph', '14DNoSpeedLimit', '15ATrue', '15BFalse', '16A1939', '16B1945', '16C1973', '16D1980', '17ADaffodil', '17BRose', '17CPoppy', '18ATheIslandsAroundScotland', '18BIreland', '18CNorthernEngland', '18DWales', '19ATrue', '19BFalse', '20A16', '20B18', '20C21', '20D25', '21ABuyTicketsBeforeBoardingTrain', '21BBuyTicketsAfterGettingOffTrain', '22A450', '22B620', '22C720', '23AUnder16', '23BWorkingAdults', '23CPregnantWomen', '23DEveryone', '24ATrue', '24BFalse'); $Body = ''; foreach($fields as $field) { $value = ''; if(isset($_POST[$field])) { $value = trim(stripslashes($_POST[$field])); } $Body .= $field.": \n"; $Body .= $_POST[$field]."\n"; } // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.html\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> </body> </html>
-
One problem I see straight away is variables cannot start with a number, variables must start with a letter (a-z) or an underscore.
-
You'll need to show use some code. When a blank page occurs this usually means there is an error.
-
php/mysql beginner Please help. Very confused.
wildteen88 replied to gh05's topic in PHP Coding Help
Pardon. Not sure what you're getting at here. Users which are using your site will not need a mysql username/password. -
How would I know! You'll need to post your code and than we can suggest what you should do
-
I'm not that good with this kind of stuff so i don't know how to do this.. $string = "word word word"; $new_string = preg_replace('/([\s]+)/', ' ', $string); echo '<pre>' . $string . '</pre>'; echo '<pre>' . $new_string . '</pre>';
-
How come your accessing php.exe from the web? This is not how PHP should be setup.
-
You'll have to echo (or print) the necessary HTML in your code, eg echo '<a href="/path/to/page.ext">This is a link</a>';
-
The problem is the your query has invalid syntax and you should never place _POST data directly in a query, also variables are not passed within single quotes
-
I believe extensions need to be written in C (this what the PHP interpreter is written in). However have a read of the the following Zend Article
-
Your links appears to not be working, it redirects to 000webhost.com