Jump to content

opel

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Everything posted by opel

  1. I have been working on a file upload script that will allow me to upload word documents, mp3's and PDF's into my site. I have been working on the following script but my validation stataments are causing the upload procedure to fail, any help or advise would be appreciated. <?php require_once('includes/inc_functions.php'); $target = "../files/"; if(isset($_POST['Submit'])) { //reads the name of the file the user submitted for uploading $image=$_FILES['file']['name']; // if it is not empty if ($image) { // get the original name of the file from the clients machine $filename = stripslashes($_FILES['file']['name']); // get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); // if it is not a known extension, we will suppose it is an error, print an error message //and will not upload the file, otherwise we continue if (($extension != "doc") && ($extension != "jpg") && ($extension != "pdf")) { echo '<h1>Unknown extension!</h1>'; $errors=1; } else { } } //If no errors registred, print the success message and show the thumbnail image created if(isset($_POST['Submit']) && !$errors) { ?> <link href="css/admin.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> function sendImg(img) { opener.document.add.image.value = img; window.close(); } </script> <h1>Thumbnail created Successfully!</h1> <img class="hand" onClick="sendImg('<?= $image_name ?>');" src="<?= $thumb_name ?>" alt="Thumnail"> <? } else { ?> <img src="../People/JunF.jpg" <!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>Untitled Document</title> </head> <body> <form name="newad" method="post" enctype="multipart/form-data" action=""> <table width="300" align="center" id="uploadImg"> <tr> <td colspan="2"><h1>Upload Files</h1></td> </tr> <tr> <td colspan="2"> <p align="center" style="font-size:10px;">You can upload files with the <strong>.MP3</strong> extension using this form. Please make sure that all your MP3's have been ID3 tags or they will not display in the flash player.</p></td> </tr> <tr> <td>Please choose a file :</td> <td><input name="file" type="file" /></td> </tr> <tr> <td colspan="2"><div align="center"> <input type="submit" value="Upload File" name="Submit" /> </div></td> </tr> <tr> <td colspan="2"><div align="center"><a href="javascript:window.close()" title="Close Window">Close Window</a></div></td> </tr> </table> </form> </div> </body> </html><? } // end else ?> If you go to this page, http://www.recommendedcosmetics.com/admin/files2.php you will see I am getting an error with unexpected $end.
  2. Is it possible to grab textual content from an external site and display it on your own site? I look after a site from my club night and we use another club community site that has users sign up that they will be attending. I simply want to grab that snippet of textual information from the community site and display it on my own site. I had a tutorial on this a year or so ago but can't find it and not sure what the technical term is I should be searching or googling for. tHanks
  3. I only know enough PHP/MySQL to edit and chop up code. I would struggle to make a forum.  :(
  4. I am trying to find a lightweight message board system for a sites that have under 300 forum members. I have used Invison and things in the past but they are pretty hard to integrate into a existing site layout. CAn anyone reccomend a reliable bulletin board system that can be easily skinned, I am looking for something like BBpress but allows uses to post image links in their message body. Cheers
  5. Still trying to learn some PHP and getting stuck again. I am trying to create a switch statement that looks at a URL and displays some HTML formated content. Below is what I have so far but I'm getting stuck on how to identify the URL as I have pages that start with the same word e.g news-list.php, news-detail.php and I would like the condition content to display for anything that starts "news". [code]<?php switch (condition) {   case "header("Location: ../central/news");" : <p>This will be my content for the news section</p>   break; case "header("Location: ../central/links");" : <p>This will be my content for the links section</p>   break;   default :   <p>This will be my default message</p>   break;   } ?>[/code] Thanks for any help or tips you can offer me.
  6. I have been working on an admin system and using links and link categories as the basis for learning PHP and SQL. I've run into a problem with the links category delete pages. What I want to do is filter out only categories that have no links assosciate with a category. Only these linkless categories can be deleted. The information for the links and categories are in 2 separate tables. The SQL statement I have at the moment works perfectly for filtering out the categories that have no links assosciate with it. However as the statement is set up it displays a NULL value for the category_id therefor I have no value to pass to the delete confirm page and script. This is the SQL statement and PHP Script I am working on at the moment. Can anyone tell me how I can get this script to work and pass out the correct category ID's please. [b]SQL [/b] [code]<?php mysql_select_db($database_CMconn, $CMconn); $query_rsLinkCatDelete = "SELECT DISTINCT categories.category_id, categories.category_name, categories.category_desc, tbl_links.category_id FROM categories LEFT JOIN tbl_links ON (categories.category_id = tbl_links.category_id)"; $rsLinkCatDelete = mysql_query($query_rsLinkCatDelete, $CMconn) or die(mysql_error()); $row_rsLinkCatDelete = mysql_fetch_assoc($rsLinkCatDelete); $totalRows_rsLinkCatDelete = mysql_num_rows($rsLinkCatDelete); ?>[/code] [b]PHP[/b] [code]  <table> <tr > <th>Category</th> <th>Delete </th> </tr> <?php do { ?>   <tr>     <?php if ($row_rsLinkCatDelete['category_id'] == 0) { // Show if recordset empty ?>       <td class="item"><?php echo $row_rsLinkCatDelete['category_name']; ?></td>       <td class="button"><a title="Delete This Item" href="linkCat_delete_detail.php?ID=<?php echo $row_rsLinkCatDelete['category_id']; ?>">Delete</a></td>       <?php } // Show if recordset empty ?></tr>   <?php } while ($row_rsLinkCatDelete = mysql_fetch_assoc($rsLinkCatDelete)); ?> </table>[/code]
  7. thanks for your help  ;D
  8. yes exactly, I am using Dreamweaver and it only lets you redirect a page. I would like to echo a success statement based on the update being true. Sorry never replied sooner never got a notifcation from the forum to my email.
  9. I have set up a page redirect from an insert from which has "addpage.php?update=true" I am trying to create an if statement to put on the addpage.php that will echo a statement to let users know the transaction worked. I have tried to start the statement but it doesnt seem to work, can anyone help? [code]<?php if header("Location: addlink.php?update=true") echo "Your article has been submitted"; ?>[/code]
  10. my problem seems to be that I have not matched a variable to the database set up but I cant see where I have gone wrong?
  11. I have attached a screen grab and pasted copy of the code. The error appears when I click the submit form and the update script is activated. [code]Notice: Undefined index: inpID in /Users/andrewcetnarskyj/Sites/GunkAdmin/central/updatescripts/updatelinks.php on line 4 Notice: Undefined index: inpTitle in /Users/andrewcetnarskyj/Sites/GunkAdmin/central/updatescripts/updatelinks.php on line 5 Notice: Undefined index: inpDescription in /Users/andrewcetnarskyj/Sites/GunkAdmin/central/updatescripts/updatelinks.php on line 6 Notice: Undefined index: inpLinkUrl in /Users/andrewcetnarskyj/Sites/GunkAdmin/central/updatescripts/updatelinks.php on line 7 Notice: Undefined index: inpCat in /Users/andrewcetnarskyj/Sites/GunkAdmin/central/updatescripts/updatelinks.php on line 8 Notice: Undefined index: inpDisplay in /Users/andrewcetnarskyj/Sites/GunkAdmin/central/updatescripts/updatelinks.php on line 9 You have successfully edited a link, click here to edit another link[/code] [attachment deleted by admin]
  12. I have been trying to my update script to post the changes to the Database, but it just is not happening  ??? I've read through every book and tutorial I have but can't see where I am going wrong. Could anyone who thinks they can help have a look please. The error I am getting says that I have an undefined index. I have attached the file and update script that I'm using. [b]Update form[/b] [code]<?php $id=$_GET['id']; mysql_select_db($dbname, $conn); $query="SELECT * FROM tbl_links, categories WHERE tbl_links.category_id = categories.category_id AND link_id=$id"; $result= mysql_query($query) or die("error querying database"); $num= mysql_num_rows($result); mysql_close(); $i=0; while ($i < $num) {$linkID=mysql_result($result,$i,"link_id"); $categoryID=mysql_result($result,$i,"category_id"); $linkTitle=mysql_result($result,$i,"link_title"); $linkDescription=mysql_result($result,$i,"link_desc"); $linkURL=mysql_result($result,$i,"link_url"); $linkDisplay=mysql_result($result,$i,"link_display"); ?> <form action="updatescripts/updatelinks.php"> <input type="hidden" name="inpID" value="<? echo "$linkID"; ?>"> <table cellpadding="5"> <tr> <th width="120">Field Name</th> <th width="378">Field Inputs</th> </tr> <tr> <td width="120"><div align="right"><strong>Category :</strong></div></td> <td> <select name="inpCat">   <?php mysql_select_db($dbname, $conn); $query_rsLinks = "SELECT * FROM categories ORDER BY category_name ASC"; $rsLinks = mysql_query($query_rsLinks, $conn) or die(mysql_error()); $row_rsLinks = mysql_fetch_assoc($rsLinks); $totalRows_rsLinks = mysql_num_rows($rsLinks);   do {  ?>   <option value="<?php echo $row_rsLinks['category_id']?>"><?php echo $row_rsLinks['category_name']?></option>   <?php } while ($row_rsLinks = mysql_fetch_assoc($rsLinks));   $rows = mysql_num_rows($rsLinks);   if($rows > 0) {       mysql_data_seek($rsLinks, 0);   $row_rsLinks = mysql_fetch_assoc($rsLinks);   } include ('../connections/dbclose.php'); ?> </select> </td> </tr> <tr> <td width="120"><div align="right"><strong>Title :</strong></div></td> <td><input type="text" name="inpTitle" value="<? echo $linkTitle ?>" class="inputbox" size="72" /></td> </tr> <tr> <td width="120"><div align="right"><strong>Description :</strong></div></td> <td><input type="text" name="inpDescription" value="<? echo $linkDescription ?>" class="inputbox" size="72" /></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td width="120"><div align="right"><strong>Link URL <em>('http;//' not required)</em> :</strong></div></td> <td><input type="text" name="inpLinkUrl" value="<? echo $linkURL ?>" class="inputbox" size="72" /></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td width="120"><div align="right"><strong>Display Link :</strong></div></td> <td><input name="inpDisplay" type="checkbox" value="<? echo $linkDisplay ?>" class="inputbox" checked="CHECKED"/></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td width="120"><div align="right"><strong>Click to submit :</strong></div></td> <td><input type="submit" value="Add This Link" name="add" id="add"/></td> </tr> </table> </form> <? ++$i; } ?> [/code] [b]Update Post Script[/b] [code]<? include ('../../connections/dbconn.php'); $linkID = $_POST['inpID']; $linkTitle = $_POST['inpTitle']; $linkDesc = $_POST['inpDescription']; $linkUrl = $_POST['inpLinkUrl']; $linkCategory = $_POST['inpCat']; $linkDisplay = $_POST['inpDisplay']; $query = "UPDATE tbl_links SET link_title='$linkTitle', link_desc='$linkDesc', link_url='$linkUrl', category_id='$linkCategory', link_display='$linkDisplay' WHERE link_id='$linkID'"; mysql_select_db($dbname, $conn) or die( "Unable to select database"); mysql_query($query); echo "<p class='message'>You have successfully edited a link, click here to <a href='edit_link.php'>edit another link</a></p>"; mysql_close(); ?>[/code]
  13. fixed it there were some errors with my SQL [code]<?php $id=$_GET['id']; mysql_select_db($dbname, $conn); $query="SELECT * FROM tbl_links, categories WHERE tbl_links.category_id = categories.category_id AND link_id=$id"; $result= mysql_query($query) or die("error querying database"); $num= mysql_num_rows($result); mysql_close(); $i=0; while ($i < $num) {$linkID=mysql_result($result,$i,"link_id"); $categoryID=mysql_result($result,$i,"category_id"); $linkTitle=mysql_result($result,$i,"link_title"); $linkDescription=mysql_result($result,$i,"link_desc"); $linkURL=mysql_result($result,$i,"link_url"); $linkDisplay=mysql_result($result,$i,"link_display"); ?> <form action="updatescripts/updatelinks.php"> <input type="hidden" name="ud_id" value="<? echo "$linkID"; ?>"> <table cellpadding="5"> <tr> <th width="120">Field Name</th> <th width="378">Field Inputs</th> </tr> <tr> <td width="120"><div align="right"><strong>Category :</strong></div></td> <td> <select name="inpCat">   <?php mysql_select_db($dbname, $conn); $query_rsLinks = "SELECT * FROM categories ORDER BY category_name ASC"; $rsLinks = mysql_query($query_rsLinks, $conn) or die(mysql_error()); $row_rsLinks = mysql_fetch_assoc($rsLinks); $totalRows_rsLinks = mysql_num_rows($rsLinks);   do {  ?>   <option value="<?php echo $row_rsLinks['category_id']?>"><?php echo $row_rsLinks['category_name']?></option>   <?php } while ($row_rsLinks = mysql_fetch_assoc($rsLinks));   $rows = mysql_num_rows($rsLinks);   if($rows > 0) {       mysql_data_seek($rsLinks, 0);   $row_rsLinks = mysql_fetch_assoc($rsLinks);   } include ('../connections/dbclose.php'); ?> </select> </td> </tr> <tr> <td width="120"><div align="right"><strong>Title :</strong></div></td> <td><input type="text" name="inpTitle" value="<? echo $linkTitle ?>" class="inputbox" size="72" /></td> </tr> <tr> <td width="120"><div align="right"><strong>Description :</strong></div></td> <td><input type="text" name="inpDescription" value="<? echo $linkDescription ?>" class="inputbox" size="72" /></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td width="120"><div align="right"><strong>Link URL <em>('http;//' not required)</em> :</strong></div></td> <td><input type="text" name="inpLinkUrl" value="<? echo $linkURL ?>" class="inputbox" size="72" /></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td width="120"><div align="right"><strong>Display Link :</strong></div></td> <td><input name="inpDisplay" type="checkbox" value="<? echo $linkDisplay ?>" class="inputbox" checked="CHECKED"/></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td width="120"><div align="right"><strong>Click to submit :</strong></div></td> <td><input type="submit" value="Add This Link" name="add" id="add"/></td> </tr> </table> </form> <? ++$i; } ?>[/code]
  14. I altered my PHP code as I realisied that my id wasn't being passed properly but no I am getting Error querying Database. [code]<?php $id=$_GET['id']; mysql_select_db($dbname, $conn); $query=" SELECT * FROM tbl_links WHERE id=$id"; $result=mysql_query($query) or die("error querying database"); $num=mysql_num_rows($result); mysql_close(); $i=0; while ($i < $num) {$linkID=mysql_result($result,$i,"link_id"); $categoryID=mysql_result($result,$i,"category_id"); $linkTitle=mysql_result($result,$i,"link_title"); $linkDescription=mysql_result($result,$i,"link_desc"); $linkURL=mysql_result($result,$i,"link_url"); $linkDisplay=mysql_result($result,$i,"link_display"); ?>[/code]
  15. I am trying to get my update script to work but for some reason I am getting an error when I try to pull the page content based on the id. The error say that there is an undefined index but I have checked my table names and everything is fine? ??? [code]<?php $id=$_GET['link_id']; mysql_select_db($dbname, $conn); $query=" SELECT * FROM tbl_links WHERE ID='$id'"; $result=mysql_query($query) or die("error querying database"); $num=mysql_num_rows($result); mysql_close(); $i=0; while ($i < $num) {$linkID=mysql_result($result,$i,"link_id"); $categoryID=mysql_result($result,$i,"category_id"); $linkTitle=mysql_result($result,$i,"link_title"); $linkDescription=mysql_result($result,$i,"link_desc"); $linkURL=mysql_result($result,$i,"link_url"); $linkDisplay=mysql_result($result,$i,"link_display"); ?> <form action="updatescripts/updatelinks.php"> <input type="hidden" name="ud_id" value="<? echo "$linkID"; ?>"> <table cellpadding="5"> <tr> <th width="120">Field Name</th> <th width="378">Field Inputs</th> </tr> <tr> <td width="120"><div align="right"><strong>Category :</strong></div></td> <td> <select name="inpCat">   <?php mysql_select_db($dbname, $conn); $query_rsLinks = "SELECT * FROM categories ORDER BY category_name ASC"; $rsLinks = mysql_query($query_rsLinks, $conn) or die(mysql_error()); $row_rsLinks = mysql_fetch_assoc($rsLinks); $totalRows_rsLinks = mysql_num_rows($rsLinks);   do {  ?>   <option value="<?php echo $row_rsLinks['category_id']?>"><?php echo $row_rsLinks['category_name']?></option>   <?php } while ($row_rsLinks = mysql_fetch_assoc($rsLinks));   $rows = mysql_num_rows($rsLinks);   if($rows > 0) {       mysql_data_seek($rsLinks, 0);   $row_rsLinks = mysql_fetch_assoc($rsLinks);   } include ('../connections/dbclose.php'); ?> </select> </td> </tr> <tr> <td width="120"><div align="right"><strong>Title :</strong></div></td> <td><input type="text" name="inpTitle" value="<? echo $linkTitle ?>" class="inputbox" size="72" /></td> </tr> <tr> <td width="120"><div align="right"><strong>Description :</strong></div></td> <td><input type="text" name="inpDescription" value="<? echo $linkDescription ?>" class="inputbox" size="72" /></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td width="120"><div align="right"><strong>Link URL <em>('http;//' not required)</em> :</strong></div></td> <td><input type="text" name="inpLinkUrl" value="<? echo $linkURL ?>" class="inputbox" size="72" /></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td width="120"><div align="right"><strong>Display Link :</strong></div></td> <td><input name="inpDisplay" type="checkbox" value="<? echo $linkDisplay ?>" class="inputbox" checked="CHECKED"/></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td width="120"><div align="right"><strong>Click to submit :</strong></div></td> <td><input type="submit" value="Add This Link" name="add" id="add"/></td> </tr> </table> </form> <? ++$i; } ?>[/code]
  16. Fixed it, here is solution should anyone else come across this: [code]<select name="inpCat">   <?php mysql_select_db($dbname, $conn); $query_rsLinks = "SELECT * FROM categories ORDER BY category_name ASC"; $rsLinks = mysql_query($query_rsLinks, $conn) or die(mysql_error()); $row_rsLinks = mysql_fetch_assoc($rsLinks); $totalRows_rsLinks = mysql_num_rows($rsLinks);   do {  ?>   <option value="<?php echo $row_rsLinks['category_id']?>"><?php echo $row_rsLinks['category_name']?></option>   <?php } while ($row_rsLinks = mysql_fetch_assoc($rsLinks));   $rows = mysql_num_rows($rsLinks);   if($rows > 0) {       mysql_data_seek($rsLinks, 0);   $row_rsLinks = mysql_fetch_assoc($rsLinks);   } include ('../connections/dbclose.php'); ?> </select>[/code]
  17. Ok I have nearly fixed it think I just have a simple problem with my SQL as my drop down is displaying the same category name more than once for some reason instead of just once instance of each. here is my working code with the dodgy SQL statement: [code]<select name="inpCat">   <?php mysql_select_db($dbname, $conn); $query_rsLinks = "SELECT * FROM categories, tbl_links WHERE categories.category_id = tbl_links.category_id ORDER BY categories.category_name"; $rsLinks = mysql_query($query_rsLinks, $conn) or die(mysql_error()); $row_rsLinks = mysql_fetch_assoc($rsLinks); $totalRows_rsLinks = mysql_num_rows($rsLinks);   do {  ?>   <option value="<?php echo $row_rsLinks['category_id']?>"><?php echo $row_rsLinks['category_name']?></option>   <?php } while ($row_rsLinks = mysql_fetch_assoc($rsLinks));   $rows = mysql_num_rows($rsLinks);   if($rows > 0) {       mysql_data_seek($rsLinks, 0);   $row_rsLinks = mysql_fetch_assoc($rsLinks);   } include ('../connections/dbclose.php'); ?> </select>[/code] [attachment deleted by admin]
  18. Ok I have nearly fixed it think I just have a simple problem with my SQL as my drop down is displaying the same category name more than once for some reason instead of just once instance of each. here is my working code with the dodgy SQL statement: <select name="inpCat">   <?php mysql_select_db($dbname, $conn); $query_rsLinks = "SELECT * FROM categories, tbl_links WHERE categories.category_id = tbl_links.category_id ORDER BY categories.category_name"; $rsLinks = mysql_query($query_rsLinks, $conn) or die(mysql_error()); $row_rsLinks = mysql_fetch_assoc($rsLinks); $totalRows_rsLinks = mysql_num_rows($rsLinks);   do {  ?>   <option value="<?php echo $row_rsLinks['category_id']?>"><?php echo $row_rsLinks['category_name']?></option>   <?php } while ($row_rsLinks = mysql_fetch_assoc($rsLinks));   $rows = mysql_num_rows($rsLinks);   if($rows > 0) {       mysql_data_seek($rsLinks, 0);   $row_rsLinks = mysql_fetch_assoc($rsLinks);   } include ('../connections/dbclose.php'); ?> </select> [attachment deleted by admin]
  19. when I inserted that script my page crashed, see example. I think we are getting there as I tested the script on a blank PHP page and it worked but only displayed one of the category links? Will I not have to use the inner join statement you mentioned above so that I can linke to the '$row[link_id]' for use in the insert form. Thanks for your help. [attachment deleted by admin]
  20. I am trying to get my drop down box to display a a list of 1 instance of available link categories, have attached screen example. I understand where I have gone wrong with my SQL by pulling out a the list from my links table as opposed to my catgeory table. I dont understand where my SQL statements should be though. The if else statement is handling everything for the input form, should I put the drop down SQL in separate delimiters? [attachment deleted by admin]
  21. I've been getting good answers with my PHP beginners problems so I will try again with this one: I have created an input form for a links management system which also allows the user to input info about a link. This form includes a dynamic list that is fed from the category DB. After looking through some other posts on the forum I managed to get my code to work on a page of its own but there are 2 problems: 1. when I include the while loop in the page like it is below nothing displays except the default option, I think for some reason the while loop is not triggering. 2. the list when I test it on page without the HTML it works but displays a link category for EVERY link in the DB not just 1 instance of each category, how do I set a limiter in my loop? have attached a png of what happens As always appreciate any help. [code]<div id="main"> <h1>Add Link</h1> <p>Please fill out the details below to add a link to the database. <strong>All of the fields must be completed before the form can be submitted.</strong></p> <div style="width:100%"> <?php if(isset($_POST['add'])) { include ('connections/config.php'); include ('connections/dbconn.php'); $linkTitle = $_POST['inpTitle']; $linkDesc = $_POST['inpDescription']; $linkUrl = $_POST['inpLinkUrl']; $linkCategory = $_POST['inpCat']; $linkDisplay = $_POST['inpDisplay']; $query = "INSERT INTO tbl_links (link_url, link_title, link_desc, category_id, link_display) VALUES ( '$linkUrl', '$linkTitle', '$linkDesc', '$linkCategory', '$linkDisplay')"; mysql_query($query) or die('Error, insert query failed'); $result = ("SELECT * FROM categories, tbl_links WHERE categories.category_id = tbl_links.category_id ORDER BY category_name"); $catResult = mysql_query($result) or die("error querying database"); $row = mysql_fetch_array($catResult); //Put at the bottom of the PHP statement include ('connections/dbclose.php'); echo "<p class='message'>Your Links have been successfully added, click here to <a href='add_link.php'>add another link</a></p>"; } else { ?> <form method="post"> <table cellpadding="5"> <tr> <th width="120">Field Name</th> <th width="378">Field Inputs</th> </tr> <tr> <td width="120"><div align="right"><strong>Category :</strong></div></td> <td><select> <?php echo "<option value=''>Select one</option>"; while($row = mysql_fetch_assoc($catResult)){ echo "<option value='$row[link_id]'>$row[category_name]</option>"; } ?> </select> </td> </tr> <tr> <td width="120"><div align="right"><strong>Title :</strong></div></td> <td><input type="text" name="inpTitle" class="inputbox" size="72" /></td> </tr> <tr> <td width="120"><div align="right"><strong>Description :</strong></div></td> <td><input type="text" name="inpDescription" class="inputbox" size="72" /></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td width="120"><div align="right"><strong>Link URL <em>('http;//' not required)</em> :</strong></div></td> <td><input type="text" name="inpLinkUrl" value="www.sitename.com" class="inputbox" size="72" /></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td width="120"><div align="right"><strong>Display Link :</strong></div></td> <td><input name="inpDisplay" type="checkbox" class="inputbox" value="Yes" checked="CHECKED"/></td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td width="120"><div align="right"><strong>Click to submit :</strong></div></td> <td><input type="submit" value="Add This Link" name="add" id="add"/></td> </tr> </table> </form> <? } ?> </div><!--tablediv--> </div><!--main--->[/code] [attachment deleted by admin]
  22. opel

    echo problem

    I'm new to PHP but eager to learn so if you have time to explain the alias or can post a URL to explanation I would be grateful.  ;D
  23. opel

    echo problem

    Sorry I just saw your post just now change it to category id and some of wild teens code and it worked. here is correct SQL [code]"SELECT tbl_links.link_id, tbl_links.link_title, tbl_links.link_desc, tbl_links.category_id, tbl_links.link_display, categories.category_name        FROM tbl_links, categories        WHERE tbl_links.category_id = categories.category_id        ORDER BY tbl_links.link_title";[/code]
  24. opel

    echo problem

    thanks for the example I changed my sql statement to match up to the my table values and got this result: "sorry no results found" here is my SQL statement : "SELECT tbl_links.link_id, tbl_links.link_title, tbl_links.link_desc, tbl_links.category_id, tbl_links.link_display, categories.category_name         FROM tbl_links, categories         WHERE tbl_links.category_id = categories.category_name         ORDER BY tbl_links.link_title"; have attached my tables SQL to and I have added further links to my DB version since then so there is definately content. [attachment deleted by admin]
  25. opel

    echo problem

    Its at the very top above the PHP script, should it be within the PHP script? I didnt think it would matter as it is only the rows I wish to loop out
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.