kopythat
Members-
Content Count
5 -
Joined
-
Last visited
About kopythat
-
Rank
Newbie
-
thanks galahad That worked great now if i want to be able to delete from this database the code should be if(isset($_POST['delete'])) {mysql_query("DELETE FROM businesses SET business='{$_POST['business_name']}',description='{$_POST['business_desc']}',emailaddress='{$_POST['business_email']}',website='{$_POST['business_website']}'") or die(mysql_error()); i have the business id="business_name", but when i delete i get an error 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 'SET business='sphere',description='',emailaddress='',website=''' at line 1am i doing something wrong???? ACTUALLY....is there a way to see a list of the links, click on the link to edit/delete and have the info show up on the same form i use and update form there. as of now i have to retype everything, and as long as i have the buusiness name correct it will update, but not delete. Thanks in advance Kopy
-
I have a simple database with a php form thats inserts the info into the database, and another file that extracts the info to display the info on another page.... Now my question is ......how do i add the EDIT button to edit the database??? here is my database CREATE TABLE `businesses` ( `id` int(10) NOT NULL auto_increment, `business` varchar(255) NOT NULL default '', `description` text NOT NULL, `emailaddress` varchar(255) NOT NULL default '', `website` varchar(255) NOT NULL default '', PRIMARY KEY (`id`)) TYPE=MyISAM AUTO_INCREMENT=2; here is my form to add <? include("include/common.php"); global $conn?><style type="text/css"><!--.style1 { font-size: 18px; font-weight: bold;}--></style><div align="center" class="style1">ADD A NEW BUSINESS TO THE LINK PAGE</div><form action="<?=$_SERVER['PHP_SELF']?>" method="POST"><table border=".01" align="center"><tr><td width="146"><B>Business Name:</b></td><td width="172"><input type="text" name="business_name" /></td></tr><tr><td><b>Business Description:</b></td><td><textarea name="business_desc" rows="15" cols="20"></textarea></td></tr><tr><td><b>E-Mail Address:</b></td><td><input type="text" name="business_email" /></td></tr><tr> <td><B>Website:</b></td> <td><div align="center"> <input name="business_website" type="text" /> <strong><BR> NO HTTP:// </strong>just<strong> WWW<BR> eg. yahoo.com/ </strong></div></td></tr><tr><td><input type="submit" name="add" value="Add!" /></td><td><input type="reset" value="Reset" /></td></tr></table></form><?phpif(isset($_POST['add'])) {mysql_query("INSERT INTO businesses SET business='{$_POST['business_name']}',description='{$_POST['business_desc']}',emailaddress='{$_POST['business_email']}',website='{$_POST['business_website']}'") or die(mysql_error());echo '<tr bgcolor="red"><td><b>Business added.</b></td></tr>';} else {echo '';}?></body></html> Here is my display links Page <?$business = $_GET['business'];global $conn?><?$query=mysql_query("SELECT business,description,emailaddress, website FROM businesses ");while($row=mysql_fetch_row($query)) echo '<table width="495"><tr><TD><div align="center"><strong>'.$row[0].'</strong></div><BR></td></TR><TR><td><div align="center">'.$row[1].'</div></td></TR><TR><td><div align="center"><B>E-mail: </B><a href="mailto:'.$row[2].'?subject=test">'.$row[2].'</a><BR></div></td></TR><TR><TD><div align="center"><B>Website: </B><a href="http://'.$row[3].'"target="_blank">'.$row[3].'</div></td></tr></table><HR width="400">';?> now i have all the info put in to the database and it displays ok, but how do i edit it to change the info, either email, website, description, and/or even delete Thank you in advance Kopy
-
kopythat started following Need Help Need mysql php script
-
Thanks for the code Mike.....it works well I have made a few changes as per formating, it does everything that i want it to do Now I need to add a picture or logo upload (mysql and php portion) but the image must be less than 400 pixels wide and 200 pixels in hieght and added to the new_business.php form........If you could help me out with that it would be greatly appreciated. Here are the modifications I have made to the code MYSQL CREATE TABLE `businesses` ( `id` int(10) NOT NULL auto_increment, `business` varchar(255) NOT NULL default '', `description` text NOT NULL default '', `emailaddress` varchar(255) NOT NULL default '', `website` varchar(255) NOT NULL default '', PRIMARY KEY(`id`) ) TYPE=MyISAM; new_business.php (added website) <form action="<?=$_SERVER['PHP_SELF']?>" method="POST"> <table border=".01" align="center"> <tr> <td><B>Business Name:</b></td> <td><input type="text" name="business_name" /></td> </tr> <tr> <td><b>Business Description:</b></td> <td><textarea name="business_desc" rows="15" cols="20"></textarea></td> </tr> <tr> <td><b>E-Mail Address:</b></td> <td><input type="text" name="business_email" /></td> </tr> <tr> <td><B>Website:</b></td> <td><input name="business_website" type="text" /></td> </tr> <tr> <td><input type="submit" name="add" value="Add!" /></td> <td><input type="reset" value="Reset" /></td> </tr> </table> </form> <?php if(isset($_POST['add'])) { mysql_query("INSERT INTO businesses SET business='{$_POST['business_name']}',description='{$_POST['business_desc']}',emailaddress='{$_POST['business_email']}',website='{$_POST['business_website']}'") or die(mysql_error()); echo '<tr bgcolor="red"><td><b>Business added.</b></td></tr>'; } else { echo ''; } ?> </body> </html> show_business.php (changed table and text formating and showed all businesses on same page) <?php $query=mysql_query("SELECT business,description,emailaddress, website FROM businesses "); while($row=mysql_fetch_row($query)) echo '<table width="495"><tr><TD><div align="center"><strong>'.$row[0].'</strong></div><BR></td></TR><TR><td><div align="center">'.$row[1].'</div></td></TR><TR><td><div align="center"><a href="mailto:'.$row[2].'">'.$row[2].'</a><BR></div></td></TR><TR><TD><div align="center"><a href="'.$row[3].'">'.$row[3].'</div></td></tr></table><HR width="400">'; ?> business.php (no changes) Didnt need Thanks again in advance Kopythat
-
basically this is the layoutto have a picture or logo <BR> Business name (linked to website or mailto) <BR> Brief description about services offered. <BR><HR> then the list goes on.......if it could be creatde so there is a "page of liinks" so on my template i can <? include ("filename.php") ?> As for the admin, just a simple form (no templating required) that he can enter in the data of the new link Business name: " "http/mailto " "Description " "Upload "Browse"then all the info will be extracted onto this "filename.php" page and will be called when included in my template "links.php"ThanksKopythat
-
I am trying to create a page on a site and I cant seem to figure it outAll it is to do is be an ad page, with an admin. to show a picture/logo with a short description of services offered, with the business name linked. I wanted an admin page for my client, who knows less than me. Then to display all info from database. Only the admin can add, or maybe submit with admin approval.If anyone can help me out that would be greatly appreciated.......either with their own code or some code out there somewhere that i canr findKopy