Forum     

Go Back   Digit Technology Discussion Forum > Portables, Peripherals and Electronics > QnA (read only)
Register FAQ Calendar Mark Forums Read

QnA (read only) Mods please help transfer the contents of this forum to proper sections. :)


 
 
LinkBack Thread Tools Search this Thread Display Modes
Old 27-12-2006, 02:51 PM   #1 (permalink)
Broken In
 
JhonCena's Avatar
 
Join Date: Nov 2006
Location: in steel cage
Posts: 130
Default Solve this PHP problem


Plzzz solve this php problem:

Code:
<html>
<head>
<title>The Joke database</title>
</head>
<body>

<?php if (isses($_GET['addjoke'])):
?>

<form action="<?echo $_SERVER['PHP_SELF']; ?>" mehod='post'>
<label>Type your joke here:<br />
</textarea></label><br />
<input type="submit" value="SUBMIT" />
</forum>

<?php
else:$dbcnx = @mysql_connect('localhost', 'root', '********');
if (!dbcnx) {
exit('<p>Unable to connect to the ' .
'database server at this time.</p>');
}

if (!@mysql_select_db('ijdb')) {
exit('<p>Unable</p>');
}

if (isset($_POST['joke'])) {
$joke = $_POST['joke'];
$sql = "INSERT INTO joke SET
joke='$joke',
jokesate=CURDATE()";
if (mysql_query($sql)) {
echo '<p>Your joke has been added. </p>';
} else {
echo '<p>EROR adding submitted joke ' .
mysql_eror() . '</p>';
}

echo '<p>Here are all the jokes in our database.</p>';

$result = @mysql_query('SELECT joke FROM joke');
if (!result) {
exit('<p>Eror</p>');
}

while ($row = mysql_fetch_array($result)) {
echo '<p>' . $row['joke'] . '</p>';
}

echo '<p><a href="' . $_SERVER['PHP_SELF'] .
'?addjoke=1">Add a Joke!</a></p>';

endif;

?>

</body>
</html>


Error:

Code:
Parse error: parse error, unexpected T_ENDIF in C:\Program Files\VertrigoServ\www\tutorial\jokes.php on line 53

Solve this prob plzzz
__________________
----------> http://www.blogofwebmasters.com/ <---------
WEBMASTERING TUTORIALS, ARTICLES AND MUCH MORE
JhonCena is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 27-12-2006, 04:31 PM   #2 (permalink)
In The Zone
 
Join Date: Oct 2004
Posts: 437
Default Re: Solve this PHP problem

any way looking at the code...it shows that you are new to php and trying to edit some script (i think i saw it in zend site)

about script bad news is that it may have suffered even bigger problem as i feel like you have not gone php toturials or books ...as you have not read about main function like isset...
(i am not saying it negatively)

so keep it up but rather than directly editing others codes first read the basics...may be good books ,toturials site...and then may be edit...

here main cause of error seem to be end if
so may be you can do like this

<html>
<head>
<title>The Joke database</title>
</head>
<body>

<?php if (isset($_GET['addjoke'])):
{
?>

<form action="<?echo $_SERVER['PHP_SELF']; ?>" mehod='post'>
<label>Type your joke here:<br />
</textarea></label><br />
<input type="submit" value="SUBMIT" />
</form>

<?php
}
else
$dbcnx = @mysql_connect('localhost', 'root', '********');

if (!dbcnx)
{
exit('<p>Unable to connect to the ' .'database server at this time.</p>');
}

if (!@mysql_select_db('ijdb'))
{
exit('<p>Unable</p>');
}

if (isset($_POST['joke']))
{
$joke = $_POST['joke'];
$sql = "INSERT INTO joke SET joke='$joke',jokesate=CURDATE()";

if (mysql_query($sql))
{
echo '<p>Your joke has been added. </p>';
}
else
{
echo '<p>EROR adding submitted joke ' .
mysql_eror() . '</p>';
}


echo '<p>Here are all the jokes in our database.</p>';

$result = @mysql_query('SELECT joke FROM joke');
if (!result)
{
exit('<p>Eror</p>');
}

while ($row = mysql_fetch_array($result))
{
echo '<p>' . $row['joke'] . '</p>';
}

echo '<p><a href="' . $_SERVER['PHP_SELF'] .'?addjoke=1">Add a Joke!</a></p>';



}//close of main if showing form
?>

</body>
</html>


i dont saw much logical things but saw just semantical things


and other bitter truth is you usually get good support for php things here may be try www.sitepoint.com/forums

and may be i have also written a joke script for foreign client ..if u seriously need it
www.jokes.bestcyberzone.com
not ad as this is not my site...means not owner

enjoy
__________________
be who u r :
Saharika is offline  
Old 27-12-2006, 06:40 PM   #3 (permalink)
Broken In
 
JhonCena's Avatar
 
Join Date: Nov 2006
Location: in steel cage
Posts: 130
Default Re: Solve this PHP problem

Now there is

Parse error: parse error, unexpected $end in C:\Program Files\VertrigoServ\www\tutorial\j2.php on line 69

I am very new to php and mysql and I got this from an ebook by kevin yank. tell me links of some more tutorials and free ebooks to learn php and mysql

Plzzz use code tags next time
__________________
----------> http://www.blogofwebmasters.com/ <---------
WEBMASTERING TUTORIALS, ARTICLES AND MUCH MORE
JhonCena is offline  
Old 27-12-2006, 06:57 PM   #4 (permalink)
Google Bot
 
Pathik's Avatar
 
Join Date: Aug 2005
Posts: 9,772
Default Re: Solve this PHP problem

try w3schools.com 4 html,php etc
Pathik is offline  
Old 27-12-2006, 09:02 PM   #5 (permalink)
String Phreak
 
mediator's Avatar
 
Join Date: Mar 2005
Location: In ur Evil Mind!
Posts: 2,457
Default Re: Solve this PHP problem

@john ......... Can u execute simple insert and fetch mysql query from php on windows?
__________________
Bad Bad server.....No candy for u!
mediator is offline  
Old 30-12-2006, 02:41 PM   #6 (permalink)
In The Zone
 
Join Date: Oct 2004
Posts: 437
Default Re: Solve this PHP problem

Quote:
Originally Posted by JhonCena
Now there is

Parse error: parse error, unexpected $end in C:\Program Files\VertrigoServ\www\tutorial\j2.php on line 69

I am very new to php and mysql and I got this from an ebook by kevin yank. tell me links of some more tutorials and free ebooks to learn php and mysql

Plzzz use code tags next time
ya the problem seems to be with the config rather than syntax
you would be better to post it in forum like
sitepoint.com/forums

by the way it is almost like official forum for that yank book so u will get great support there
__________________
be who u r :
Saharika is offline  
Old 30-12-2006, 05:14 PM   #7 (permalink)
Broken In
 
JhonCena's Avatar
 
Join Date: Nov 2006
Location: in steel cage
Posts: 130
Default Re: Solve this PHP problem

^^^^^^^^^^^Thank you very much for providing the link^^^^^^^^^^
__________________
----------> http://www.blogofwebmasters.com/ <---------
WEBMASTERING TUTORIALS, ARTICLES AND MUCH MORE
JhonCena is offline  
Old 05-01-2007, 07:07 AM   #8 (permalink)
Right Off the Assembly Line
 
Join Date: Jan 2007
Posts: 1
Default Re: Solve this PHP problem

I think you forgot a } for the if statement from this piece of code:

if (isset($_POST['joke'])) {
$joke = $_POST['joke'];
$sql = "INSERT INTO joke SET joke='$joke', jokesate=CURDATE()";
if (mysql_query($sql)) {
echo '<p>Your joke has been added. </p>';
}
else
{
echo '<p>EROR adding submitted joke ' . mysql_eror() . '</p>';
}
bpeel is offline  
Old 05-01-2007, 09:13 AM   #9 (permalink)
Broken In
 
JhonCena's Avatar
 
Join Date: Nov 2006
Location: in steel cage
Posts: 130
Default Re: Solve this PHP problem

Thanks for the late reply

I think you are very new to this forum
hi and welcome to thinkdigit forum. and happy foruming. hope you ll like to stay here. read all the rules of thinkdigit forum before proceeding

next time use code tags ([CODE some code [/CODE)
thanx 4 reply I 'll try this later
__________________
----------> http://www.blogofwebmasters.com/ <---------
WEBMASTERING TUTORIALS, ARTICLES AND MUCH MORE
JhonCena is offline  
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Tenida
- by Charan
- by abhidev
- by Sujeet
- by Sarath

Advertisement




All times are GMT +5.5. The time now is 09:40 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2