
Chubichan
Members-
Posts
27 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
Chubichan's Achievements

Newbie (1/5)
0
Reputation
-
Yep everything is in there table wise. I am at a loss. Had a guy at work take a look and he is mainly cold fusion so he couldn't really tell me anything, just how he would do it in CF. Also, I know that I should not be using a while loop. For some reason that is all that I can find as examples. Maybe that is where my problem lies. I dunno.
-
My CMS pulls from the database just perfectly fine. My website pulls just perfectly fine. However, my put.php file will not insert into the database. Everything showing up on the website was manually inserted by me in phpmyadmin. I know this code probably isn't the best, but if someone could please help a complete newbie I would appreciate it. This code used to work, now the put.php form handler file will not update and I don't ever remember touching it. It is something to do with either the cms or the put file. Take a look...I know the code isn't the best... <?php Content Management php file session_start(); if(!session_is_registered(myusername)) { header("location:login.php"); } include 'config.php'; include 'opendb.php'; $query = mysql_query("SELECT * FROM cms"); while($row = mysql_fetch_array($query)) { $home = $row[('home')]; $field01 = $row[('field01')]; $field02 = $row[('field02')]; $field03 = $row[('field03')]; $field04 = $row[('field04')]; $field05 = $row[('field05')]; $mot = $row[('team')]; $sta = $row[('sta')]; $pf = $row[('form')]; $add = $row[('additionalforms')]; $fi = $row[('financial')]; $loc = $row[('location')]; $con = $row[('contact')]; $ms = $row[('mission')]; $about = $row[('aboutus')]; $dis = $row[('disclaimer')]; $addr = $row[('address')]; $addr02 = $row[('address02')]; } $query = mysql_query("SELECT * FROM employees"); while($row = mysql_fetch_array($query)) { $sta01 = $row[('sta01')]; $sta02 = $row[('sta02')]; $sta03 = $row[('sta03')]; $sta04 = $row[('sta04')]; $sta05 = $row[('sta05')]; $sta06 = $row[('sta06')]; $title01 = $row[('title01')]; $title02 = $row[('title02')]; $title03 = $row[('title03')]; $title04 = $row[('title04')]; $title05 = $row[('title05')]; $title06 = $row[('title06')]; } ?> <!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=UTF-8" /> <title>Dr. Michael D. Doyle | Payment Information</title> <LINK REL=StyleSheet HREF="content_management.css" TYPE="text/css" /> <script defer type="text/javascript" src="pngfix.js"></script> <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script> <script>var browser = navigator.appName var ver = navigator.appVersion var thestart = parseFloat(ver.indexOf("MSIE"))+1 //This finds the start of the MS version string. var brow_ver = parseFloat(ver.substring(thestart+4,thestart+7)) //This cuts out the bit of string we need. if ((browser=="Microsoft Internet Explorer") && (brow_ver < ) //By default the min. IE ver is set to 6. Change as desired. { window.location="http://www.drmdoyle.com/out_of_date.php"; //URL to redirect to. } //--> </script> </head> <body> <div id="container"> <h3>Michael D. Doyle Content Management System</h3> <h3>Temporary Maintenance. For updates, please contact admin.</h3> <div id="form_wrapper"> <form method="post" action="put.php"> <div><label for="field01">Top Link One</label><input type="text" name="field01" value="<?php echo $field01 ?>"/></div> <div><label for="field02">Top Link Two</label><input type="text" name="field02" value="<?php echo $field02 ?>"/></div> <div><label for="field03">Top Link Three</label><input type="text" name="field03" value="<?php echo $field03 ?>"/></div> <div><label for="field04">Top Link Four</label><input type="text" name="field04" value="<?php echo $field04 ?>"/></div> <div><label for="field05">Top Link Five</label><input type="text" name="field05" value="<?php echo $field05 ?>"/></div> <p>Enter your staff members and their job titles here</p> <div><label for="sta01">Staff 01</label><input type="text" name="sta01" value="<?php echo $sta01 ?>" maxlength="50"/></div> <div><label for="title01">Job Title</label><input type="text" name="title01" value="<?php echo $title01 ?>" maxlength="50"/></div> <div><label for="sta02">Staff 02</label><input type="text" name="sta02" value="<?php echo $sta02 ?>" maxlength="50"/></div> <div><label for="title02">Job Title</label><input type="text" name="title02" value="<?php echo $title02 ?>" maxlength="50"/></div> <div><label for="sta03">Staff 03</label><input type="text" name="sta03" value="<?php echo $sta03 ?>" maxlength="50"/></div> <div><label for="title03">Job Title</label><input type="text" name="title03" value="<?php echo $title03 ?>" maxlength="50"/></div> <div><label for="sta04">Staff 04</label><input type="text" name="sta04" value="<?php echo $sta04 ?>" maxlength="50"/></div> <div><label for="title04">Job Title</label><input type="text" name="title04" value="<?php echo $title04 ?>"maxlength="50"/></div> <div><label for="sta05">Staff 05</label><input type="text" name="sta05" value="<?php echo $sta05 ?>" maxlength="50"/></div> <div><label for="title05">Job Title</label><input type="text" name="title05" value="<?php echo $title05 ?>" maxlength="50"/></div> <div><label for="sta06">Staff 06</label><input type="text" name="sta06" value="<?php echo $sta06 ?>" maxlength="50"/></div> <div><label for="title06">Job Title</label><input type="text" name="title06" value="<?php echo $title06 ?>" maxlength="50"/></div> <p>To add paragraphs for any text below this line, press RETURN.</p> <div><label for="index">Homepage</label><textarea name="home" rows="15" cols="50" ><?php echo $home ?> </textarea></div> <div><label for="mot"><?php echo $field01 ?></label><textarea name="mot" rows="15" cols="50" ><?php echo $mot ?> </textarea></div> <div><label for="sta">Staff</label><textarea name="sta" rows="15" cols="50" ><?php echo $sta ?> </textarea></div> <div><label for="pf"><?php echo $field02 ?></label><textarea name="pf" rows="15" cols="50" ><?php echo $pf ?> </textarea></div> <div><label for="add">Additional Forms</label><textarea name="add" rows="15" cols="50" ><?php echo $add ?> </textarea></div> <div><label for="fi"><?php echo $field03 ?></label><textarea name="fi" rows="15" cols="50" ><?php echo $fi ?> </textarea></div> <div><label for="loc"><?php echo $field04 ?></label><textarea name="loc" rows="15" cols="50" ><?php echo $loc ?> </textarea></div> <div><label for="con"><?php echo $field05 ?></label><textarea name="con" rows="15" cols="50"><?php echo $con ?> </textarea></div> <div><label for="ms">Mission Statement</label><textarea name="ms" rows="15" cols="50" ><?php echo $ms ?> </textarea></div> <div><label for="about">About our Practice</label><textarea name="about" rows="15" cols="50" ><?php echo $about ?> </textarea></div> <div><label for="dis">Disclaimer</label><textarea name="dis" rows="15" cols="50" ><?php echo $dis ?> </textarea></div> <p>Input addresses here. This information is pulled to everywhere the address appears on the site.</p> <div><label for="address">Address</label><textarea name="address" rows="15" cols="50" ><?php echo $addr ?> </textarea></div> <p>Input second address here.</p> <div><label for="address02">Address 2</label><textarea name="address02" rows="15" cols="50" ><?php echo $addr02 ?> </textarea></div> <p>Would you like to add a new user? <div><label for="newuser">New Username</label><input type="text" name="newuser" /></div> <div><label for="newpass">New Password</label><input type="text" name="newpass" /></div> <div class="actions"><input type="submit" name="submit" value="Submit Content" class="submit"/></div> </form> <p> <a href="logout.php">Log Out</a></p> </div> </div> </body> </html> put.php form handler file <?php if(isset($_POST['submit'])) { include 'config.php'; include 'opendb.php'; $home = $_POST['home']; $field01 = $_POST['field01']; $field02 = $_POST['field02']; $field03 = $_POST['field03']; $field04 = $_POST['field04']; $field05 = $_POST['field05']; $mot = $_POST['mot']; $sta = $_POST['sta']; $pf = $_POST['pf']; $add = $_POST['add']; $fi = $_POST['fi']; $loc = $_POST['loc']; $con = $_POST['con']; $ms = $_POST['ms']; $about = $_POST['about']; $dis = $_POST['dis']; $addr = $_POST['address']; $addr02 = $_POST['address02']; $sta01 = $_POST['sta01']; $sta02 = $_POST['sta02']; $sta03 = $_POST['sta03']; $sta04 = $_POST['sta04']; $sta05 = $_POST['sta05']; $sta06 = $_POST['sta06']; $title01 = $_POST['title01']; $title02 = $_POST['title02']; $title03 = $_POST['title03']; $title04 = $_POST['title04']; $title05 = $_POST['title05']; $title06 = $_POST['title06']; $newuser = $_POST['newuser']; $newpass = $_POST['newpass']; $query = "INSERT INTO cms (home, field01, field02, field03, field04, field05, team, sta, form, additionalforms, financial, location, contact, mission, aboutus, disclaimer, address, address02) VALUES ('$home', '$field01', '$field02', '$field03', '$field04', '$field05', '$mot', '$sta', '$pf', '$add', '$fi', '$loc', '$con', '$ms', '$about', '$dis', '$addr', '$addr02')"; $query = "INSERT INTO employees (sta01, sta02, sta03, sta04, sta05, sta06, title01, title02, title03, title04, title05, title06) VALUES ('$sta01', '$sta02', '$sta03', '$sta04', '$sta05', '$sta06', '$title01', '$title02', '$title03', '$title04', '$title05', '$title06')"; $query = "INSERT INTO members (username, password) VALUES ('$newuser', '$newpass')"; mysql_query($query) or die('An error has occured.: ' . mysql_error()); include 'closedb.php'; echo "You have successfully updated your web content. Check"; } ?> <a href="http://www.drmdoyle.com">your site</a> now, or <a href="http://www.drmdoyle.com/content_management.php">edit more stuff</a>.
-
Can you use include to pull in a file containing variables?
Chubichan replied to Chubichan's topic in PHP Coding Help
Maybe there is a better way to do what I want to do. I want to update my variables in one spot. I want to have one file that I can stick all that stuff in and reference to it. If there is not a way to do it then that is cool, but perhaps there is a way. So I am asking. -
I have this at the top of all my pages that will pull from my database. <?php include 'config.php'; include 'opendb.php'; $query = mysql_query("SELECT * FROM cms"); while($row = mysql_fetch_array($query)) { include 'variables.php'; } ?> This is the variables.php file <?php $home = nl2br($row['home']); $field01 = nl2br($row['field01']); $field02 = nl2br($row['field02']); $field03 = nl2br($row['field03']); $field04 = nl2br($row['field04']); $field05 = nl2br($row['field05']); $mot = nl2br($row['team']); $sta = nl2br($row['sta']); $pf = nl2br($row['form']); $add = nl2br($row['additionalforms']); $fi = nl2br($row['financial']); $loc = nl2br($row['location']); $con = nl2br($row['contact']); $ms = nl2br($row['mission']); $about = nl2br($row['aboutus']); $dis = nl2br($row['disclaimer']); $addr = nl2br($row['address']); $addr02 = nl2br($row['address02']); $new = nl2br($row['newuser']); $newpass = nl2br($row['newpass']); ?> config.php and opendb.php aren't of any concern and work just fine. Any ideas why this would not be working? Am I abusing include?
-
Thanks for the help, like I said I am building my first cms. I am just going by books I have purchased and tutorials at the moment.
-
Very sorry but could you provide an example? This is my very first cms ???
-
Am I doing this correctly? I am using a cms to update a client's web site. I want the database to populate the cms text boxes so that I can quickly see and update the website content quickly and easily. The client will also be using this cms to do so herself. From what I have researched on the internet this is supposedly the correct way to accomplish this. Please anyone take a look and help me if you can. The text boxes are still blank and there is data in the database that it should be pulling into the textareas. <!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=UTF-8" /> <title>Dr. Michael D. Doyle | Payment Information</title> <LINK REL=StyleSheet HREF="content_management.css" TYPE="text/css" /> </head> <body> <div id="container"> <h3>Michael D. Doyle Content Management System</h3> <div id="form_wrapper"> <form method="post" action="put.php"> <div><label for="index">Homepage</label><textarea name="home" rows="15" cols="70" ><?php echo $home ?> </textarea></div> <div><label for="mot">Meet Our Team</label><textarea name="mot" rows="15" cols="70" ><?php echo $mot ?> </textarea></div> <div><label for="pf">Patient Forms</label><textarea name="pf" rows="15" cols="70" ><?php echo $pf ?> </textarea></div> <div><label for="fi">Financial Information</label><textarea name="fi" rows="15" cols="70" ><?php echo $fi ?> </textarea></div> <div><label for="loc">Locations</label><textarea name="loc" rows="15" cols="70" ><?php echo $loc ?> </textarea></div> <div><label for="con">Contact</label><textarea name="con" rows="15" cols="70"><?php echo $con ?> </textarea></div> <div><label for="ms">Mission Statement</label><textarea name="ms" rows="15" cols="70" ><?php echo $ms ?> </textarea></div> <div><label for="dis">Disclaimer</label><textarea name="dis" rows="15" cols="70" ><?php echo $dis ?> </textarea></div> <div class="actions"><input type="submit" name="submit" value="Submit Content" class="submit"/></div> </form> </div> </div> </body> </html>
-
[SOLVED] Why isn't this working? Am I missing something?
Chubichan replied to Chubichan's topic in PHP Coding Help
No idea what I have done to fix it, but it is fixed. I think I may have just had a small typo in my opendb.php file....But I am not sure. FIXED!! Thanks to all who helped! -
[SOLVED] Why isn't this working? Am I missing something?
Chubichan replied to Chubichan's topic in PHP Coding Help
Prints an error: Error connecting to mysql from: or die ('Error connecting to mysql') -
[SOLVED] Why isn't this working? Am I missing something?
Chubichan replied to Chubichan's topic in PHP Coding Help
Like this: <?php $conn = mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname) or die ('Error connecting to mysql'); ?> -
[SOLVED] Why isn't this working? Am I missing something?
Chubichan replied to Chubichan's topic in PHP Coding Help
It printed this: No worky: No database selected Sorry that I am such a noobster, but what exactly would fix this? I am connecting to my database just fine I thought.... ????, Adam -
[SOLVED] Why isn't this working? Am I missing something?
Chubichan replied to Chubichan's topic in PHP Coding Help
Changed it. Close, but no cigar. Still giving me the error that it can't insert into the table. Any other advice anyone has? I absolutely cannot think of what it is that I am doing wrong. I have ran over this code a million times. -
[SOLVED] Why isn't this working? Am I missing something?
Chubichan replied to Chubichan's topic in PHP Coding Help
New code. Still doesn't work <!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=UTF-8" /> <title>Dr. Michael D. Doyle | Payment Information</title> <LINK REL=StyleSheet HREF="content_management.css" TYPE="text/css" /> </head> <body> <div id="container"> <h3>Michael D. Doyle Content Management System</h3> <div id="form_wrapper"> <form method="post" action="put.php"> <div><label for="index">Homepage</label><textarea name="home" rows="15" cols="70"> </textarea></div> <div><label for="mot">Meet Our Team</label><textarea name="mot" rows="15" cols="70"> </textarea></div> <div><label for="pf">Patient Forms</label><textarea name="pf" rows="15" cols="70"> </textarea></div> <div><label for="fi">Financial Information</label><textarea name="fi" rows="15" cols="70"> </textarea></div> <div><label for="loc">Locations</label><textarea name="loc" rows="15" cols="70"> </textarea></div> <div><label for="con">Contact</label><textarea name="con" rows="15" cols="70"> </textarea></div> <div><label for="ms">Mission Statement</label><textarea name="ms" rows="15" cols="70"> </textarea></div> <div><label for="dis">Disclaimer</label><textarea name="dis" rows="15" cols="70"> </textarea></div> <div class="actions"><input type="submit" input name="submit" value="Submit Content" class="submit"/></div> </form> </div> </div> </body> </html> put.php: <?php if(isset($_POST['submit'])) { include 'config.php'; include 'opendb.php'; $home = $_POST['home']; $mot = $_POST['mot']; $pf = $_POST['pf']; $fi = $_POST['fi']; $loc = $_POST['loc']; $con = $_POST['con']; $ms = $_POST['ms']; $dis = $_POST['dis']; $query = "INSERT INTO cms (home, team, form, financial, location, contact, mission, disclaimer) VALUES ('$home', '$mot', '$pf', '$fi', '$loc', '$con', '$ms', '$dis')"; mysql_query($query) or die('No worky'); include 'closedb.php'; echo "Worky!"; } ?> -
[SOLVED] Why isn't this working? Am I missing something?
Chubichan replied to Chubichan's topic in PHP Coding Help
changed the name to name="add" and got this Error, insert query failed from line 17: mysql_query($query) or die('Error, insert query failed'); AHHHH -
[SOLVED] Why isn't this working? Am I missing something?
Chubichan replied to Chubichan's topic in PHP Coding Help
changed name to home and in all corresponding locations. Any other advice?