wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
Have a read of the manual on mysql_affected_rows.
-
If the user has to paste that code in then use a textarea
-
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>
-
want to have images in folder outside the public_html folder
wildteen88 replied to jasonc's topic in PHP Coding Help
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. -
want to have images in folder outside the public_html folder
wildteen88 replied to jasonc's topic in PHP Coding Help
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\">" ; Yes, but having nest P tags is invalid HTML.
-
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
-
Server script not rendered correctly by browser
wildteen88 replied to engineerChris's topic in PHP Coding Help
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.'; }
-
rewrite is working, but changes directory
wildteen88 replied to tsoltysiak's topic in Apache HTTP Server
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). -
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
-
Help counting variables and applying a rule
wildteen88 replied to Chappers's topic in PHP Coding Help
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);
-
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);
-
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);
-
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.