![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
wildteen88
-
Posts
10,480 -
Joined
-
Last visited
Never
Posts posted by wildteen88
-
-
If the user has to paste that code in then use a textarea
-
this is also not working correct i get the success and then die('Δεν έγινε η σύνδεση με την βάση δεδομένων'.mysql_error());
both times even i put a existing travel_id and even i put a not existing travel_id
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.
-
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" />
-
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.
-
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.
-
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,
-
Just clear your computers cache. Or do a hard refresh (Ctrl + F5).
-
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>
-
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.
-
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.
-
You need to escape the double quotes within your string
echo "<p class=\"SuperqAndQAndA\">" ;
Also, can I nest different p classes?Yes, but having nest P tags is invalid HTML.
-
I don't understand why you can't define the variables, then include the heredoc. Which would parse all of the variables that have been defined.
You can do that. Just make sure the heredoc statement is included after you have defined the variables.
-
Variables are not parsed within single quotes. You can do either of the following
$site = $event . '.php'; OR $site = "{$event}.php";
-
If the .htaccess file is in web/
Your rewrite rule should be
RewriteRule colour/([A-Za-z0-9]+)$ index.php?colour=$1
-
I created a PHP script to do this, and included it in my HTML page in this manner:
<form action="procSomeForm.php" method="post"> <?php include "genSelectList.php"; ?> <input class="main" type="submit" name="submit[view]" value="View" style="width:70px"/> </form>
Make sure that code is placed within a .php file. PHP code will not run within .html files.
-
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.'; }
-
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).
-
however i cant login or register or anything
What is the code use for these actions?
-
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
-
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.
-
Should do as you're passing $dbname when it is being called
deleteEmptyRecords($dbname);
-
specifically built to clean out empty records.
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);
-
all i want to do is somehow sort
Sort by what?
get only the first rowIf 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);
-
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.
Query was empty
in PHP Coding Help
Posted
Have a read of the manual on mysql_affected_rows.