fife
Members-
Posts
381 -
Joined
-
Last visited
Everything posted by fife
-
I just read those pages and I really dont understand what you mean.
-
if(isset($_POST['insert_club'])){ //Process data for validation $intro = nl2br((trim($_POST['intro']))); $about = nl2br((trim($_POST['about']))); //perform validations $errors = array(); if(empty($intro)) { $errors[] = "Please enter an introduction to your company"; } if(empty($about)) { $errors[] = "Please enter an about section of your company"; } //Check if there were errors if(count($errors)===0) { // Prepare data for db insertion $query = "UPDATE `table` SET `intro` = '$intro', `about` = '$about' WHERE validationID = '$validation1'"; $result= mysql_query($query) or die(mysql_error()); That is my form. the error is.... You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 've got no idea
-
When a user on my site is entering words like you're don't i've the site is saying that the field has an error in it. Is there a way to stop this and allow the correct formatting automatically. each field is already ran through trim, nl2br, mysql_real_escape_string Cheers
-
Hi. Does anybody know of some good RTE's out there. i have just been using NiceEdit and although the software is very good. It doesn't work properly for what I need. I need one that I can add and remove features from too
-
Thank you it was RANGE that was screwing things up
-
Can somebody please tell me how to get a more accurate error other than "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'range, serialnum, assetnum, altid, testcertnum, dept, custodian, agency, categor' at line 1" Ive tried looking at the logs so I can see where this error is referencing but there are no errors there! Is there Dbug code that can be used? There is just so much happing on the page and the error being so vague I just cant figure it out! I know it has something to do with the insert statement but I cant see what.
-
Cheers Ken. That fixed everything
-
$TheClubq = mysql_query("SELECT * FROM table WHERE clubID = '$_SESSION['ClubID']'"); $TheClub = mysql_fetch_array($TheClubq);
-
I have this php code for echoing an address of my member. Certain arts of the address are not always there <?php if($TheClub['addressL1']!==NULL) { echo "<li>{$TheClub['addressL1']}</li>"; } if($TheClub['addressL2']!==NULL) { echo "<li>{$TheClub['addressL2']}</li>"; } if($TheClub['addressL3']!==NULL) { echo "<li>{$TheClub['addressL3']}</li>"; } echo "<li>{$TheClub['area']}</li>"; echo "<li>{$TheClub['county']}<?li>"; echo "<li>{$TheClub['country']}</li>"; echo "<li>{$TheClub['postcode']}</li>"; ?> the code works fine in crome and all other browsers it looks like so addressL1 addressL2 addressL3 area county country postcode In IE however lets say addressL2 and area was missing it shows with nasty line spaces like so addressL1 addressL3 county country postcode Is there a way of stopping this? Ive tried using an else { } but that has not solved the issue. Any suggestions?
-
how do you submit a form from a button? I have the code below just to check my form is submitting and its not..... if(isset($_POST['clubinsert'])){ echo "It worked!"; } <form action="" method="POST" id="myclubfrm"> <input type="image" src="<?php if ($CP['logo']=='logo_default.jpg') { echo "../images/logo_default.jpg"; } else { echo "/members/images/{$CP['county']}/{$CP['logo']}"; } ?>" width="60" height="60" id="clubinsert" name="clubinsert" > <input name="club" type="hidden" value="<?php echo $CP['clubID'];?>"> <input name="pap" type="hidden" value="<?php echo $CP['permission'];?>"> </form>
-
OMG thank you so much. I have been looking at that for over an hour! Again thank you
-
I did dump html code. there is the correct formatting I just missed it for shortening purposes. The view source shows...... <input type="image" scr="../images/logo_default.jpg" width="200" height="133" name="clubinsert"> <input name="club" type="hidden" value=""> <input name="pap" type="hidden" value="">
-
ok I have this looping query which works and displays everything I need while ($CP = mysql_fetch_array($Link)) { if ($CP['logo']=='logo_default.jpg') { echo "<img src=\"/images/logo_default.jpg\" border='0' alt=\"{$CP['name']}\" />"; } else { echo "<img src=\"/members/images/{$CP['county']}/{$CP['logo']}\" border='0' alt=\"{$CP['name']}\" />"; } $CP['clubID']; } Now I want to have a form where the only visible element is club image so I have made that form.... while ($CP = mysql_fetch_array($Link)) { <form action="" id="myclubfrm"> <input type="image" scr="<?php if ($CP['logo']=='logo_default.jpg') { echo "/images/logo_default.jpg"; } else { echo "/members/images/{$CP['county']}/{$CP['logo']}"; } ?>" width="200" height="133" name="clubinsert" > <input name="club" type="hidden" value="<?php $CP['clubID']; ?>"> <input name="pap" type="hidden" value="<?php $CP['permission'];?>"> </form> } The issue is that if I do it the second way no image is displayed. Just blank a image box with writing in the middle saying submit
-
sorry the blank entries are appearing in the clubs table
-
I have an issue with some code I have. All the code works correctly apart from when submit is clicked not only does it update a the current club but it creates a blank entry in the database! I cant see whats wrong. Here is the code......... //gets $validation = $_GET['new_club']; //Querys $qGetClub = "SELECT * FROM clubs WHERE validationID = '$validation'"; $rGetClub = mysql_query($qGetClub); $Club = mysql_fetch_array($rGetClub); //Query for category by name $qGetCat = "SELECT * FROM club_category WHERE catID = ".$Club['cat'].""; $rGetCat = mysql_query($qGetCat); $CatName = mysql_fetch_array($rGetCat); //query for related sub categorys. $qGetSub = "SELECT * FROM sub_categorys WHERE catID =".$Club['cat'].""; $rSubCat = mysql_query($qGetSub); // query for groups created $Groupq = mysql_query("SELECT * FROM groups WHERE memberID = '".$User['memberID']."'"); //end of querys if(isset($_POST['insert_clubbtn1'])){ //Process data for validation $subcat = trim($_POST['subcat']); $NewSubCat = trim($_POST['NewSubCat']); //Prepare data for db insertion $subcat = mysql_real_escape_string($subcat); //find the new category //insert $result = mysql_query("UPDATE clubs SET `sub_category` = '$subcat' WHERE validationID ='$validation'") or die(mysql_error()); if ($result!=="") { $otherg = trim($_POST['other_groups']); $newg = trim($_POST['new_group']); $newg = mysql_real_escape_string($newg); //if an item other than none from the list is selected then update the club with an ID relating to the group it belongs to if ($otherg !=='None') { $groupsq = mysql_query("UPDATE `clubs` SET groupID ='$otherg' WHERE validationID ='$validation'") or die (mysql_error()); } // If none is selected then $newg must have a value so create a new group in the groups table and then on the next page I will add the group in the club table else { $groupsq = mysql_query("INSERT INTO `groups` (`memberID`, `group`, `clubID`) VALUES ('".$User['memberID']."', '$newg', '".$Club['clubID']."')")or die (mysql_error()); } } if ($NewSubCat !="") { mail("mail","New Sub Category Request","Dear Ring Master, \n\nThe club in the name of $name with a validation code of $validationID would like a new sub category called $new_cat\n\n \nTeam Arena\n\n\n\n"); } $url = "/members/create/create_clubp3.php?new_club=$validation"; header("Location: $url"); }
-
Hi all. Im trying to insert from one form 3 items of data into to different tables. I will post the code as most of my notes are in there but first....... What is happening is the form is filled in then the first part of the form where it updates my clubs table with category ID's works fine. Nothing in the if ($result) { } seems to run. I have create some fake groups so the drop down is populated with groups already created and I have tried to select one of these groups so it can be entered into the clubs table and nothing. No errors just no answers. Does anybody no what I am doing wrong? first Ill post the form and the querys that make fields in the form... Querys //gets $validation = $_GET['new_club']; //Querys $qGetClub = "SELECT * FROM clubs WHERE validationID = '$validation'"; $rGetClub = mysql_query($qGetClub); $Club = mysql_fetch_array($rGetClub); //Query for category by name $qGetCat = "SELECT * FROM club_category WHERE catID = ".$Club['cat'].""; $rGetCat = mysql_query($qGetCat); $CatName = mysql_fetch_array($rGetCat); //query for related sub categorys. $qGetSub = "SELECT * FROM sub_categorys WHERE catID =".$Club['cat'].""; $rSubCat = mysql_query($qGetSub); // query for groups created $Groupq = mysql_query("SELECT * FROM groups WHERE memberID = '".$User['memberID']."'"); then we have the form <form action="" method="post" id="insert_clubfrm"> <tr valign="baseline"> <td colspan="2" valign="top"><br/><p>Your Chosen category was <strong><?php echo $CatName['categorys'];?></strong> Please select a sub category.</p><br></td> </tr> <tr valign="baseline"> <td width="132" valign="top" >Club Sub Category:</td> <td width="256" valign="top" ><select name='subcat'> <option value="None">Please Select One</option> <?php while ($New_SubCat = mysql_fetch_assoc($rSubCat)) { ?> <option value="<?php echo $New_SubCat['subID']; ?>"><?php echo $New_SubCat['sub_categorys']; ?></option>"<?php } ?> </select> </td> </tr> <tr valign="baseline"> <td colspan="2" valign="top" ><br/><p>If your sub category does not exist in the list please select "none" above and enter your new sub categroy below.</p><br></td> </tr> <tr valign="baseline"> <td valign="top" class="left_padding">New Sub Category</td> <td valign="top" class="left_padding"><input type="text" name="newSubCat" id="new_cat" value="" /></td> </tr> <tr valign="baseline"> <td colspan="2" valign="top" class="left_padding"><br/> If you had/have more than one site and you had to give your group of companies a name what would that name be? <br/></td> </tr> <tr valign="baseline"> <td valign="top" class="left_padding">Group Name:</td> <td valign="top" class="left_padding"><label for="other_groups"></label> <select name="other_groups" id="other_groups"> <option>None</option> <?php while ($group = mysql_fetch_assoc($Groupq)) { ?> <option value="<?php echo $group['groupID']; ?>"><?php echo $group['group']; ?></option>"<?php } ?> </select></td> </tr> <tr valign="baseline"> <td valign="top" class="left_padding">Group Name:</td> <td valign="top" class="left_padding"><label for="new_groups"></label> <input type="text" name="new_group" value=""> </td> </tr> <tr valign="baseline"> <td valign="top" nowrap="nowrap"> </td> <td valign="top"><div align="left"> <input type="submit" id="insert_clubbtn1" name="insert_clubbtn1" value="Insert record" /> </div></td> </tr> </table> </form> now the code to make the form work... if(isset($_POST['insert_clubbtn1'])){ //Process data for validation $subcat = trim($_POST['subcat']); $NewSubCat = trim($_POST['NewSubCat']); $otherg = trim($_POST['other_groups']); $newg = trim($_POST['new_groups']); //Prepare data for db insertion $newg = mysql_real_escape_string($newg); $subcat = mysql_real_escape_string($subcat); //find the new category //insert $result = mysql_query("UPDATE clubs SET `sub_category` = '$subcat' WHERE validationID ='$validation'") or die(mysql_error()); if ($result) { //if an item other than none from the list is selected then update the club with an ID relating to the group it belongs to if ($otherg !=='None') { $groupsq = mysql_query("UPDATE `clubs` SET groupID ='$otherg' WHERE validationID ='$validation')") or die (mysql_error()); } // If none is selected then $newg must have a value so create a new group in the groups table and then on the next page I will add the group in the club table if ($otherg == 'None') { $groupsq = mysql_query("INSERT INTO `groups` (memberID, group, clubID) VALUES ('".$User['memberID']."', '$newg', ''".$Club['clubID']."')"); } } if ($NewSubCat !="") { mail("email","New Sub Category Request","Dear Owner, \n\nThe club in the name of $name with a validation code of $validationID would like a new sub category called $new_cat\n\n \nTeam Me\n\n\n\n"); } $url = "/create/create_clubp3.php?new_club=$validation"; header("Location: $url");
-
cool thanks again Ken
-
can someone please tell me how to echo the current time or date? I have the date in the format 1306768978 in the database but I dont want to echo it back that way obviously. Not only that but does anybody know of a good tutorial on how to use this function?
-
Hi. I am completely new to writing javascript but I write a lot of php. I just have a question about where I can learn something. I have a post comment form...... <form action="" method="post" name="post-chat" id="post-chat"> <input name="my-chat-field" type="text" size="50" maxlength="500"> <input name="id" type="hidden" value="mem-ID"> <input name="submit-my-chat" type="submit" value="Submit"> </form> I want to be able to submit this form and the post appear straight away in the page. Because I am so new to this I have no idea what to search for and have spent the last 3 hours hunting around with no results. Can somebody please point my in the right direction or tell me the individual pieces I need to learn to do this? Thank you
-
ok new code. the form........... <?php include('Connections/superconnect.php'); ?> <?php if(isset($_POST['long'])){ $name = trim($_POST['full-name']); $insertq = "INSERT INTO `customer_details` (`full_name`) VALUES (`$name`)"; $insert = mysql_query($insertq) or die (mysql_error()); $url = "/index.php"; header("Location: $url"); } ?> <form action="" method="POST" name="longform1" id="longform1" > <input name="fullname" type="text" id="fullname" size="25" maxlength="50" /> <input type="submit" name="long" id="long" value=" Submit " /> </form> the database..... table = customer_details full_name the new error............. Unknown column 'danny' in 'field list' It cant be an unknown column as thats now all there is. No more server error though so thank you for that.
-
ok this is killing me!!!!! I have a form with serveral fields but I'm only going to show one field for now <?php include('/Connections/dbconnect.php'); ?> <?php if(isset($_POST['long'])){ $name = trim($_POST['fullname']); $insertq = ("INSERT INTO customer_details (`full_name`,) VALUES (`$name`) "); $insert = mysql_query($insertq) or die (mysql_error); $url = "/index.php"; header("Location: $url"); } ?> <form action="" method="POST" name="longform1" id="longform1" > <input name="fullname" type="text" id="fullname" size="25" maxlength="50" /> <input type="submit" name="long" id="long" value=" Submit " /> </form> in the data base I have a table called "customer_details" which has customerID, full_name simple stuff so far!!!!!!!!!!! the database conntect file has............... $hostname_superconnect = "localhost"; $database_superconnect = "connect"; $username_superconnect = "name"; $password_superconnect = "password"; $superconnect = mysql_pconnect($hostname_superconnect, $username_superconnect, $password_superconnect) or trigger_error(mysql_error(), mysql_select_db($database_superconnect); when I enter a name into the field the page comes back blank and says only.... mysql_error When I check the server error logs i get..... [Wed May 11 16:17:25 2011] [error] [client ] File does not exist: /home/sites/site.com/public_html/none [Wed May 11 16:17:38 2011] [error] [client ] PHP Warning: include(../Connections/dbconnect.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/sites/site.com/public_html/index.php on line 1, referer: http://www.site.com/index.php [Wed May 11 16:17:38 2011] [error] [client ] PHP Warning: include(../Connections/dbconnect.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/sites/site.com/public_html/index.php on line 1, referer: http://www.site.com/index.php [Wed May 11 16:17:38 2011] [error] [client ] PHP Warning: include() [<a href='function.include'>function.include</a>]: Failed opening '../Connections/dbconnect.php' for inclusion (include_path='.:/usr/share/pear5') in /home/sites/site.com/public_html/index.php on line 1, referer: http://www.site.com/index.php [Wed May 11 16:17:38 2011] [error] [client ] PHP Warning: mysql_query() [<a href='function.mysql-query'>function.mysql-query</a>]: Access denied for user 'sit'@'localhost' (using password: NO) in /home/sites/site.com/public_html/index.php on line 14, referer: http://www.site.com/index.php [Wed May 11 16:17:38 2011] [error] [client ] PHP Warning: mysql_query() [<a href='function.mysql-query'>function.mysql-query</a>]: A link to the server could not be established in /home/sites/site.com/public_html/index.php on line 14, referer: http://www.site.com/index.php Does anybody know whats wrong here. It must be a server error but thats just a beginners guess
-
ok if I echo the query as asked I get this........ SELECT favourites.*, club_category.* FROM favourites INNER JOIN club_category ON favourites.favourite = club_category.catID WHERE favourite.memberID = 0000000003 I dont get whats going wrong. The query works great if I write it..... $fav = mysql_query("SELECT * FROM favourites WHERE memberID = ".$User['memberID']." ORDER BY `order`"); while($row = mysql_fetch_array($fav)) { if ($row['favourite']) echo " <li>{$row['favourite']}</li> "; } This issue is that it only echos the numbers out this way. Ive done many JOIN's now and they have never been a problem. I just cant see whats wrong at all.