lmcgr44 Posted February 11, 2011 Share Posted February 11, 2011 hello i have a script that send a checkbox to the database, if it is checked it is sent to mysql as a 1 and not checked sent as 0, but when the info is sent the 1 for checked is sent to title and title is sent to ingredients and etc... these are the scripts add_recipie.php <?php // Start_session, check if user is logged in or not, and connect to the database all in one included file include_once("scripts/checkuserlog.php"); // Include the class files for auto making links out of full URLs and for Time Ago date formatting include_once("wi_class_files/autoMakeLinks.php"); include_once ("wi_class_files/agoTimeFormat.php"); // Create the two objects before we can use them below in this script $activeLinkObject = new autoActiveLink; $myObject = new convertToAgo; ?> <?php // Include this script for random member display on home page include_once "scripts/homePage_randomMembers.php"; ?> <?php $sql_blabs = mysql_query("SELECT id, mem_id, the_blab, blab_date FROM blabbing ORDER BY blab_date DESC LIMIT 30"); $blabberDisplayList = ""; // Initialize the variable here while($row = mysql_fetch_array($sql_blabs)){ $blabid = $row["id"]; $uid = $row["mem_id"]; $the_blab = $row["the_blab"]; $notokinarray = array("fag", "gay", "shit", "fuck", "stupid", "idiot", "asshole", "cunt", "douche"); $okinarray = array("sorcerer", "grey", "shug", "farg", "smart", "awesome guy", "asshole", "cake", "dude"); $the_blab = str_replace($notokinarray, $okinarray, $the_blab); $the_blab = ($activeLinkObject -> makeActiveLink($the_blab)); $blab_date = $row["blab_date"]; $convertedTime = ($myObject -> convert_datetime($blab_date)); $whenBlab = ($myObject -> makeAgo($convertedTime)); //$blab_date = strftime("%b %d, %Y %I:%M:%S %p", strtotime($blab_date)); // Inner sql query $sql_mem_data = mysql_query("SELECT id, username, firstname, lastname FROM myMembers WHERE id='$uid' LIMIT 1"); while($row = mysql_fetch_array($sql_mem_data)){ $uid = $row["id"]; $username = $row["username"]; $firstname = $row["firstname"]; if ($firstname != "") {$username = $firstname; } // (I added usernames late in my system, this line is not needed for you) /////// Mechanism to Display Pic. See if they have uploaded a pic or not ////////////////////////// $ucheck_pic = "members/$uid/image01.jpg"; $udefault_pic = "members/0/image01.jpg"; if (file_exists($ucheck_pic)) { $blabber_pic = '<div style="overflow:hidden; width:40px; height:40px;"><img src="' . $ucheck_pic . '" width="40px" border="0" /></div>'; // forces picture to be 100px wide and no more } else { $blabber_pic = "<img src=\"$udefault_pic\" width=\"40px\" height=\"40px\" border=\"0\" />"; // forces default picture to be 100px wide and no more } $blabberDisplayList .= ' <table width="100%" align="center" cellpadding="4" bgcolor="#CCCCCC"> <tr> <td width="7%" bgcolor="#FFFFFF" valign="top"><a href="profile.php?id=' . $uid . '">' . $blabber_pic . '</a> </td> <td width="93%" bgcolor="#EFEFEF" style="line-height:1.5em;" valign="top"><span class="greenColor textsize10">' . $whenBlab . ' <a href="profile.php?id=' . $uid . '">' . $username . '</a> said: </span><br /> ' . $the_blab . '</td> </tr> </table>'; } } ?> <!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" /> <meta name="Description" content="Web Intersect is a deft combination of powerful free open source software for social networking, mixed with insider guidance and tutorials as to how it is made at its core for maximum adaptability. The goal is to give you a free website system that has a network or community integrated into it to allow people to join and interact with your website when you have the need." /> <meta name="Keywords" content="web intersect, how to build community, build social network, how to build website, learn free online, php and mysql, internet crossroads, directory, friend, business, update, profile, connect, all, website, blog, social network, connecting people, youtube, myspace, facebook, twitter, dynamic, portal, community, technical, expert, professional, personal, find, school, build, join, combine, marketing, optimization, spider, search, engine, seo, script" /> <title>CookBookers</title> <link href="style/main.css" rel="stylesheet" type="text/css" /> <link rel="icon" href="favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> <script src="js/jquery-1.4.2.js" type="text/javascript"></script> <style type="text/css"> #Layer1 { height:210px; } .style3 {font-size: 24px} body { background-color: #3c60a4; } </style> </head> <body> <p> <?php include_once "header_template.php"; ?> </head> <body style="margin:0px;"> <center> </p> <table border="0" align="center" cellpadding="0" cellspacing="0" class="mainBodyTable"> <tr> <td width="235" valign="top"> <td width="665" colspan="2" align="left" valign="top" style="background-color:#EFEFEF; border:#999 0px; padding:10px;"> <table border="0" cellpadding="6"> <tr> <td> <form method="POST" action="include/recipe.php"> <table cellpadding="0px" border="0" align="left" cellspacing="5px" style="font-size:14px;"> <tr> <td><span class="style3">Add New Recipie:</span><br /></td> <tr> <td><h4 style="margin-bottom:5px; color:brown;">Public:</h4> <input name="Pub" value="0" type="checkbox" id="Pub" value="checkbox" /> </td> </tr> <tr> <td><h4 style="margin-bottom:5px; color:brown;">Title: </h4> <input type="text" name="title"></td> </tr> <tr> <td><h4 style="margin-bottom:5px; color:brown;">Makes: </h4> <input type="text" name="make"></td> </tr> <tr> <td><h4 style="margin-bottom:5px; color:brown;">Ingrediants: </h4> <textarea rows="10" name="ingr" cols="40"></textarea><br></td> </tr> <tr> <td><h4 style="margin-bottom:5px; color:brown;">Method: </h4> <textarea rows="10" name="desc" cols="40"></textarea></td> </tr> <tr> <td><h4 style="margin-bottom:5px; color:brown;">Notes: </h4> <textarea rows="10" name="note" cols="40"></textarea></td> </tr> <tr> <td><input type="submit" value="Submit" style="padding:5px 10px;"></td> </tr> </table> </form> </td> </tr> </table> </tr> </table> </td> </tr> </table> <?php include_once "footer_template.php"; ?> </body> insert recipie <?php //include("session.php"); include("database.php"); @session_start(); $user = $_SESSION['username']; //die($user); $Pub=$_POST['Pub']; $title=$_POST['title']; $make=$_POST['make']; $ingr=$_POST['ingr']; $desc=$_POST['desc']; $note=$_POST['note']; //if($user=="Guest"||$user==""){ //header("Location: ../index.php"); //} //else{ $database->AddRecipe($user,$Pub,$title,$make,$ingr,$desc,$note); header("Location: ../add_recipie.php"); //} ?> Quote Link to comment Share on other sites More sharing options...
Maq Posted February 11, 2011 Share Posted February 11, 2011 So what's the problem? Quote Link to comment Share on other sites More sharing options...
lmcgr44 Posted February 11, 2011 Author Share Posted February 11, 2011 So what's the problem? the feilds are being put into mysql in the wrong ones, if i tick the public box it will place it into the title field and if i dont tick the public box it dosent put anything into the title box but everytime the title goes to the ingredents box and the ingrediants goes to the method box etc.. do u get what i mean? Quote Link to comment Share on other sites More sharing options...
sunfighter Posted February 11, 2011 Share Posted February 11, 2011 I would check the order in which your adding your information: $database->AddRecipe($user,$Pub,$title,$make,$ingr,$desc,$note); to the order of your DB columns. Quote Link to comment Share on other sites More sharing options...
lmcgr44 Posted February 11, 2011 Author Share Posted February 11, 2011 I would check the order in which your adding your information: $database->AddRecipe($user,$Pub,$title,$make,$ingr,$desc,$note); to the order of your DB columns. hey thanks, my database order goes id, user, pub, title, make, ingr, desc then note, it is all in the rite order, could there be anything else wrong? like with the script? i just attached a screen shot of the phpmyadmin for you to have a look [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 11, 2011 Share Posted February 11, 2011 Post your AddRecipe code Quote Link to comment Share on other sites More sharing options...
lmcgr44 Posted February 12, 2011 Author Share Posted February 12, 2011 Post your AddRecipe code if you look at my first post it is there Quote Link to comment Share on other sites More sharing options...
ameyemad Posted February 12, 2011 Share Posted February 12, 2011 Can you post the source script for function "AddRecipe"? Quote Link to comment Share on other sites More sharing options...
lmcgr44 Posted February 12, 2011 Author Share Posted February 12, 2011 Can you post the source script for function "AddRecipe"? hey both scripts that are needed to add recipie are up the top, except the one that connect to the database, but the one to send it is up top Quote Link to comment Share on other sites More sharing options...
ameyemad Posted February 12, 2011 Share Posted February 12, 2011 No it's not there. We need to see where to data is actually being inserted into the database, so there should be a code similar to @mysql_query("INSERT INTO table SET ......"); Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 12, 2011 Share Posted February 12, 2011 I suspect the OP is using a framework, if he doesn't know where the code for "AddRecipe" is. Quote Link to comment Share on other sites More sharing options...
lmcgr44 Posted February 12, 2011 Author Share Posted February 12, 2011 I suspect the OP is using a framework, if he doesn't know where the code for "AddRecipe" is. hello yes i do know where the addrecipie script is, the file is called database and i have worked out the problem Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.