Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Have a read of the manual on mysql_affected_rows.
  2. If the user has to paste that code in then use a textarea
  3. I have not modified your code. I have suggested that use the mysql_affected_rows() function when checking to see if your query has deleted a record from your database.
  4. This code if ($_POST[submit]){ foreach ($_POST[check] as $key => $value) { $checkup = $_POST['check'][$key]; $q = "DELETE * FROM pictures WHERE id ='".$row['id']."'"; $sql = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());} } needs to be if (isset($_POST['delete_images'])) { if(is_array($_POST['check'])) { $ids = implode(',', $_POST['check']); $q = "DELETE * FROM pictures WHERE id = IN($ids)"; $sql = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error()); } } And name your delete images button <input type="submit" name="delete_images" value="delete images" />
  5. This code here is correct <?php $con=mysql_connect("localhost","developer","javalab"); mysql_query("SET NAMES UTF8"); if(!$con) { die('Δεν έγινε η σύνδεση με την βάση δεδομένων'.mysql_error()); } $tID = $_POST["tID"]; mysql_select_db("cycladestravel", $con); $result = mysql_query("delete from `travels` where `travel_id`='$tID' limit 1",$con); @mysql_close($conn); if(!$result){ echo 'error'; }else{ echo 'success'; } You need to use mysql_affected_rows to check whether the query actually deleted a row from your database. This line if(!$result){ Will only check to see if mysql_query did not return false. mysql_query will only return false when there is a problem with the query.
  6. If you need help with your HTML then post a question within the HTML Board. This forum is for getting help with your PHP code not HTML layout issues.
  7. No that code is to be used in a command shell for defining the symlink. You first need to open a command terminal move to the directory where you want the symlink and then run the command requinix suggested. Next add Options +FollowSymLinks to a .htaccess file in the public/ directory,
  8. Just clear your computers cache. Or do a hard refresh (Ctrl + F5).
  9. Why do you need nested paragraph tags? If you're using P tags to layout the content in your site then you should look into using divs <div id="mainContent"> <p>Paragraph 1</p> <p>Paragraph 2</p> </div>
  10. Place all the images that cant be hotlinked within a different directory. Using the guide I linked to you can then just place the .htaccess file within that directory.
  11. What you want to do is prevent people hotlinking your images on their sites. You can do this by using a .htaccess file as this guide explains.
  12. You need to escape the double quotes within your string echo "<p class=\"SuperqAndQAndA\">" ; Yes, but having nest P tags is invalid HTML.
  13. You can do that. Just make sure the heredoc statement is included after you have defined the variables.
  14. Variables are not parsed within single quotes. You can do either of the following $site = $event . '.php'; OR $site = "{$event}.php";
  15. If the .htaccess file is in web/ Your rewrite rule should be RewriteRule colour/([A-Za-z0-9]+)$ index.php?colour=$1
  16. Make sure that code is placed within a .php file. PHP code will not run within .html files.
  17. You have place the code coolcam262 suggested in wrong place. The if (mysql_num_rows($sql) > 0){ line should go before the while loop Change while ($row = mysql_fetch_array($sql)){ echo 'box_num: '.$row['box_number']; echo '<br/> dept: '.$row['Department']; echo '<br/> company: '.$row['Company']; echo '<br/> status: '.$row['status']; echo '<br/> location: '.$row['location']; echo '<br/> description: '.$row['box_desc']; if (mysql_num_rows($sql) > 0){ } else{ echo 'No Boxes available please use your back button to select a new box.'; } echo '<br/><br/>'; } To if (mysql_num_rows($sql) > 0) { while ($row = mysql_fetch_array($sql)) { echo 'box_num: '.$row['box_number']; echo '<br/> dept: '.$row['Department']; echo '<br/> company: '.$row['Company']; echo '<br/> status: '.$row['status']; echo '<br/> location: '.$row['location']; echo '<br/> description: '.$row['box_desc']; } } else { echo 'No Boxes available please use your back button to select a new box.'; }
  18. You need to rewrite your links so they start with a / eg <a href="/varX.php">Link</a> If you do not do that the web browser will try to load varX.php within the /special directory (even though it doesn't actually exist).
  19. What is the code use for these actions?
  20. You cannot connect external storage devices to an ipad. However you can transfer files to/from the ipad using wifi or bluetooth explained here http://store.apple.com/uk/question/answers/product/MC533D/A?pqid=QX4PJJYXUYCDH4KKT7JAUFHA4D792PF9X Ipad is compatible with PC and Macs. EDIT Maybe I am wrong. There is the HyperDrive http://www.hypershop.com/HyperDrive-iPad-Hard-Drive-s/183.htm
  21. Have a look at this snippet. Have a play with it so you understand how it works. Then see if you can apply it your code.
  22. Should do as you're passing $dbname when it is being called deleteEmptyRecords($dbname);
  23. If you're validating your data correctly before it is inserted into the database then you shouldn't need to do this. If you want to make your code a function then do this function deleteEmptyRecords($dbname) { $sql="DELETE FROM ".$dbname." . property WHERE property . id=''"; mysql_query($sql) or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $sql . "<br />\nError: (" . mysql_errno() . ") " . mysql_error()); $sql="DELETE FROM ".$dbname." . agents WHERE agents . ip_source=''"; mysql_query($sql) or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $sql . "<br />\nError: (" . mysql_errno() . ") " . mysql_error()); $sql="DELETE FROM ".$dbname." . settings WHERE settings . prop_id=''"; mysql_query($sql) or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $sql . "<br />\nError: (" . mysql_errno() . ") " . mysql_error()); } Call it using deleteEmptyRecords($dbname);
  24. Sort by what? If you're wanting to get the first record that is closet to KMS 201 Then just use LIMIT 1 rather than LIMIT 0, 30 $query = 'SELECT * FROM `fares`WHERE `KMS` >=201 LIMIT 1'; $result = mysql_query($query);
  25. Line 11 should read $ms = mysql_pconnect($host, $user, $pass); You left of the $ before the 'host'. You then edit these variables $host = "localhost"; $user = "UserName"; $pass = "Password"; $db = "dbName"; With your database credentials. You can leave $host at it is.
×
×
  • 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.