Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP/MySQL code inspection
Old 12-20-2005, 02:39 AM PHP/MySQL code inspection
Junior Talker

Posts: 1
Trades: 0
Hey guys, I thought i would introduce myself with a little code analysis help.

When I access this page via IE, Opera, FireFox, etc... I receive a blank HTML page. I verifide server side programs (PHP, MySQL) settings and make sure the MySQL statements where proper. Anyways this is just a beginner program i'm writing for educational purposes.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Input and submit favorites to firstdb </TITLE>
</HEAD>

<BODY>
<?php
require("openfirstdb.php");
if (@($submitted)) {
$title = addslashes(trim($title));
$description= addslashes(trim($description));
$valuesx = " VALUES ('0', '" . $title . "', '" . $description . "')";
$query="INSERT INTO favorites " . $valuesx;
print("Insert query is: " . $query);
$result = mysql_db_query($DBname, $query, $link);
if ($result) {
print("The favorite was successfully added.<br>\n");
}
else {
print("The favorite was NOT successfully added. <br>\n");
}
$submitted = FALSE;
mysql_close($link);
print("<a href=\"saddfavoriter.php\">Submit another favorite </a><br>");
} //ends if submitted
else {
?>
<h1>Add a title to the databank of favorite shows. <br></h1>
<?
$sq = "SELECT * FROM favorites";
print("<h3>Favorites</h3><br>");
$rs = mysql_db_query($DBname, $sq, $link);
print("<table><tr><td> Titles</td><td>Description</td></tr> ");
print("\n");
while ($row=mysql_fetch_array($rs)) {
print("\n");
print("<tr><td>");
print($row["title"]);
print("</td><td>");
print($row["description"]);
print("</td></tr>");
} //end while
print("</table>");
?>
<form action="saddfavoriter.php" method="POST"><br>
Title of show <input type=text name="title" size=50> <br>
Description <input type=text name="description" size=50> <br>
<input type=hidden name="submitted" value="True"><br>
<input type=submit name="submit" value="Submit favorite!"><br>
</form>
<?
} //ends else clause for submitting form
?>
</BODY>
</HTML>


Thanks,

--Curtis
curveo is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to PHP/MySQL code inspection
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23007 seconds with 12 queries