dfrieber
08-10-2005, 11:29 AM
Hi all,
So in my most recently designed webpage, I have a journal which I want to format in php so that I may update it simply by entering data into a form. I have learned php as best I could and threw it together. But it doesn't work.
What I have is index.html (http://www.accentsbydesign.net/frieber/update/index.html) (the page the html form displays on note: only the "journal" form is currently active), update_journal.php (http://www.accentsbydesign.net/frieber/update/update_journal.php) (the page that the form on index.html submits to), and index.php (http://www.accentsbydesign.net/frieber/index.php) (the page on which the journal lies).
Since you won't be able to read my php on update_journal.php and index.php, i've copied and pasted the php on each page here:
update_journal.php
<?
$link = mysql_connect('localhost', 'xxxxxxxxx', 'xxxxxxxx');
$db_select = mysql_select_db('accentsbydesign_net_-_journal', $link);
mysql_query("INSERT INTO news (`journal_id`,`journal_titleofentry`,`journal_entr y`,`journal_date`,`journal_time`,`journal_songname `,`journal_bandname`) VALUES ('{$_POST[journal_id]}','{$_POST[journal_titleofentry]}','{$_POST[journal_entry]}','{$_POST[journal_date]}','{$_POST[journal_time]}','{$_POST[journal_songname]}','{$_POST[journal_bandname]}')");
echo "$_POST[journal_id] <br/> $_POST[journal_titleofentry] <br/> $_POST[journal_entry] <br/> $_POST[journal_date] <br/> $_POST[journal_time] <br/> $_POST[journal_songname] <br/> $_POST[journal_bandname] <br/>";
?>
index.php
<?
$link = mysql_connect('localhost', 'xxxxxx', 'xxxxxx');
$db_select = mysql_select_db('accentsbydesign_net_-_journal', $link);
$result = mysql_query('SELECT * FROM `news` order by id desc', $link);
// if (!$link) { die("you suck at php"); }
//echo mysql_stat($link);
//echo mysql_num_rows($result);
while($fed_row = mysql_fetch_row($result)) {
$obit_list .= "
<font class=\"heading\">$fed_row[1]</font><br>
$fed_row[2]
<br>
</ul>
<font class=\"date\">posted <b>".date("l, F jS, Y", strtotime($fed_row[3]))."</b> at <b>$fed_row[4]</b></font><br>
<font class=\"current_music\">while listening to <b>$fed_row[5]</b> by <b>$fed_row[6]</b></font><br><br>
<center><img src=\"dotted.gif\"></center><br> ";
}
echo "$obit_list";
mysql_close($link);
?>
So there it is. Im so new at php that i dont even know if this is a problem that can be solved here, or if knowledge of the database is necessary.
All help is greatly appreciated!
-dan
ps: in the php coding above, i have replaced my username and password with "xxxxxxx"
ps2: as youll notice on index.php, i receieve the following message:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/virtual/site231/fst/var/www/html/frieber/index.php on line 36
maybe this is assist in the solution to my problem, maybe not. thanks anyways!
So in my most recently designed webpage, I have a journal which I want to format in php so that I may update it simply by entering data into a form. I have learned php as best I could and threw it together. But it doesn't work.
What I have is index.html (http://www.accentsbydesign.net/frieber/update/index.html) (the page the html form displays on note: only the "journal" form is currently active), update_journal.php (http://www.accentsbydesign.net/frieber/update/update_journal.php) (the page that the form on index.html submits to), and index.php (http://www.accentsbydesign.net/frieber/index.php) (the page on which the journal lies).
Since you won't be able to read my php on update_journal.php and index.php, i've copied and pasted the php on each page here:
update_journal.php
<?
$link = mysql_connect('localhost', 'xxxxxxxxx', 'xxxxxxxx');
$db_select = mysql_select_db('accentsbydesign_net_-_journal', $link);
mysql_query("INSERT INTO news (`journal_id`,`journal_titleofentry`,`journal_entr y`,`journal_date`,`journal_time`,`journal_songname `,`journal_bandname`) VALUES ('{$_POST[journal_id]}','{$_POST[journal_titleofentry]}','{$_POST[journal_entry]}','{$_POST[journal_date]}','{$_POST[journal_time]}','{$_POST[journal_songname]}','{$_POST[journal_bandname]}')");
echo "$_POST[journal_id] <br/> $_POST[journal_titleofentry] <br/> $_POST[journal_entry] <br/> $_POST[journal_date] <br/> $_POST[journal_time] <br/> $_POST[journal_songname] <br/> $_POST[journal_bandname] <br/>";
?>
index.php
<?
$link = mysql_connect('localhost', 'xxxxxx', 'xxxxxx');
$db_select = mysql_select_db('accentsbydesign_net_-_journal', $link);
$result = mysql_query('SELECT * FROM `news` order by id desc', $link);
// if (!$link) { die("you suck at php"); }
//echo mysql_stat($link);
//echo mysql_num_rows($result);
while($fed_row = mysql_fetch_row($result)) {
$obit_list .= "
<font class=\"heading\">$fed_row[1]</font><br>
$fed_row[2]
<br>
</ul>
<font class=\"date\">posted <b>".date("l, F jS, Y", strtotime($fed_row[3]))."</b> at <b>$fed_row[4]</b></font><br>
<font class=\"current_music\">while listening to <b>$fed_row[5]</b> by <b>$fed_row[6]</b></font><br><br>
<center><img src=\"dotted.gif\"></center><br> ";
}
echo "$obit_list";
mysql_close($link);
?>
So there it is. Im so new at php that i dont even know if this is a problem that can be solved here, or if knowledge of the database is necessary.
All help is greatly appreciated!
-dan
ps: in the php coding above, i have replaced my username and password with "xxxxxxx"
ps2: as youll notice on index.php, i receieve the following message:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/virtual/site231/fst/var/www/html/frieber/index.php on line 36
maybe this is assist in the solution to my problem, maybe not. thanks anyways!