HuggieBear
Members-
Posts
1,899 -
Joined
-
Last visited
Everything posted by HuggieBear
-
Firstly I'd remove the @ from the front of @mysql_select_db. @ supresses any error messages, which if you're having problems, is probably kind of useful. Regards Huggie
-
[SOLVED] Hyperlinking table cells to a PHP script
HuggieBear replied to plastik77's topic in PHP Coding Help
That's right, then it's as easy as using $_GET['test_id'] in the page being called. Don't forget to use the solved button to mark this topic as solved. Regards Huggie -
If you mean how should it be formatted, I'd go for this, although you haven't specified which database you're using, so I can't confirm if the syntax is exactly right. <?php $query = "SELECT * FROM datersv WHERE (" . $ci . " BETWEEN datersv.date_in AND datersv.date_out) OR (" . $co . " BETWEEN datersv.date_in AND datersv.date_out)"; ?> Regards Huggie
-
[SOLVED] Hyperlinking table cells to a PHP script
HuggieBear replied to plastik77's topic in PHP Coding Help
If your table named Test has a unique id as a primary key then this shouldn't be too difficult. Just include the id as a GET parameter in the URL. Where you have: echo "<td>".$name."</td>"; Change to this: echo "<td><a href='test_detail.php?test_id=" . $id . "'>" . $name . "</a></td>"; Where I have test_detail.php, change this to the name of your detail page, and where I have $id, change this to the name of the id column in your database. Regards Huggie -
Have you made any attempt at coding it yourself, if you have, can you post your code here. If you haven't and are just looking for someone to write it for you then you should post in the Freelance board of this forum. This is a help board, and as such, we provide help, suggestions and recommendations, we don't write if for you I'm afraid. Regards Huggie
-
Try the following: <?php // Get the details of the image list($width, $height, $type, $html_string, $mime) = getimagesize($_FILES['avatar']['tmp_name']); // Print out the width and height echo "Width: $width<br>\n"; echo "Height: $height<br>\n"; ?> Or alternatively, get all the information and list it like so <?php // Get the details of the image $image_details = getimagesize($_FILES['avatar']['tmp_name']); // Print out all information foreach ($image_details as $v){ echo "$v<br>\n"; } ?> This will be ordered as follows... Width, Height, type of image, html string to use in <img> tags, mime type. But I prefer the first method. Regards Huggie
-
[SOLVED] Multiple Checkbox Query using text as values not numbers
HuggieBear replied to greencoin's topic in PHP Coding Help
That's correct. Regards Rich -
[SOLVED] Multiple Checkbox Query using text as values not numbers
HuggieBear replied to greencoin's topic in PHP Coding Help
I prefer a while() loop, but what you have should work fine. The for() loop isn't looking at the values of the items to determine how many times to loop, it's looking at a count of how many items are in the array (by using size_of(), the same as count()). Regards Huggie -
Something like this? <?php for ($a = 1; $a < 13; $a++){ if ($a < 10){ $a = "0" . $a; } echo "<option value='$a'>$a</option>\n"; } ?> Regards Huggie
-
Do you mean add a column that can accept an unlimited amount of characters? Regards Huggie
-
Mosts good hosts provide you with a private directory outside the web root directory so that isn't accessible via a browser, but that scripts can see. Check this with you host. Alternatively, if you have access to edit your .htaccess files, it can be done with these too. Regards Huggie
-
[SOLVED] If Statement which always executes whatever it considers.
HuggieBear replied to Foser's topic in PHP Coding Help
'0' is the column offset, if it's confusing then the following would be better... <?php if (isset($_POST['submit'])){ $user = mysql_real_escape_string($_POST['username']); $pw = md5(sha1(md5(md5($_POST['password'])))); $sql = "SELECT * FROM user_info WHERE username = '$user' AND password = '$pw'"; $result = mysql_query($sql); if (mysql_num_rows($result) == 1){ $row = mysql_fetch_array($result, MYSQL_ASSOC); $_SESSION['RIGHTS'] = $row['rights']; $_SESSION['LOGGEDIN'] = TRUE; $_SESSION['UNAME'] = $user; if ($_SESSION['LOGGEDIN']){ header("Location: account.php"); exit; } else { echo "You have typed in an incorrect password or/and username."; } } Regards Huggie -
Also, when the page is rendered, right click it and look at the source. Does the path to the image look correct there? Regards Huggie
-
Give this a try... <?php // Start the SQL string $sql = "SELECT * FROM users_info WHERE 1=1"; // Add each parameter if it's needed if (isset($_GET['textfieldSearch'])){ $sql .= " AND "; $sql .= "(user_name LIKE '%" . $_GET['textfieldSearch'] . "%' OR "; $sql .= "email_address LIKE '%" . $_GET['textfieldSearch'] . "%' OR "; $sql .= "telephone LIKE '%" . $_GET['textfieldSearch'] . "%' OR "; $sql .= "user_surname LIKE '%" . $_GET['textfieldSearch'] . "%' OR "; $sql .= "speciality LIKE '%" . $_GET['textfieldSearch'] . "%')"; } if (isset($_GET['select_speciality'])){ $sql .= " AND "; $sql .= "speciality LIKE '%" . $_GET['select_speciality'] . "%'"; } if (isset($_GET['select_company'])){ $sql .= " AND "; $sql .= "firm_company LIKE '%" . $_GET['select_company'] . "%'"; } if (isset($_GET['select_surname'])){ $sql .= " AND "; $sql .= "user_surname LIKE '%" . $_GET['select_surname'] ."%'"; } if (isset($_GET['select_country'])){ $sql .= " AND "; $sql .= "user_country LIKE '%" . $_GET['select_country'] . "%'"; } /* *** NONE OF THIS SHOULD BE NEEDED *** // Finish the SQL - 1. Remove any ending AND or WHERE if (substr($sql, strlen($sql) - strlen('WHERE ')) == 'WHERE ') { $sql = substr($sql, 0, strlen($sql) - strlen('WHERE ')); } if (substr($sql, strlen($sql) - strlen('AND ')) == 'AND ') { $sql = substr($sql, 0, strlen($sql) - strlen('AND ')); } */ // Finish the SQL - 2. Add the order by $sql .= " ORDER BY user_name ASC"; print_r($sql); // Perform the search mysql_select_db($my_connection); $RS_search_country = mysql_query($sql, $my_connection) or die(mysql_error()); $row_RS_search_country = mysql_fetch_assoc($RS_search_country); $totalRows_RS_search_country = mysql_num_rows($RS_search_country); ?> I added WHERE 1=1 into the initial SQL, this helps by only needing an " AND " each time, and also removing the need to tidy up the end of the query with all that strlen()/substr() rubbish. Regards Huggie
-
Create Screen capture from a user submitted url
HuggieBear replied to eware3000's topic in PHP Coding Help
The software that site uses is very reasonably priced... Check it out here. Regards Huggie -
Create Screen capture from a user submitted url
HuggieBear replied to eware3000's topic in PHP Coding Help
It can be done, take a look at WebShotsPro Regards Huggie -
Search the PHP manual for Array Functions. Here's the one you want: array_unshift() $a = array(1,2,3); array_unshift($a, 0); Regards Huggie
-
The regular expression line maybe better like this... if (preg_match('/(?:<a.*?href|www\.)/is',$string) Regards Huggie
-
Search this forum for further details on CAPTCHA. Regards Huggie
-
Yes, that's possible. You could add the path of the image to the file too and use it like that. Regards Huggie
-
Yeah, are the numbers all in the same format? e.g (12345) 123456 or something similar? Regards Huggie
-
If it's just images and you're using PHP >= 4.3.0 then just use getimagesize() as this returns the mime-type of the image. Regards Huggie
-
[SOLVED] trying to split an email database query into 2 sections
HuggieBear replied to zeddeh's topic in PHP Coding Help
You're welcome, there are a couple of other functions you could use, but this is the least memory intensive and the easiest in this situation I believe. Regards Huggie -
No they won't! The only records that will show are those from the year 2000! That's what the hard coded 2000 is doing in this line... $query = '2000-'.$month.'-'.$day; Regards Huggie
-
Retrieve value stored in ENUM for default option in drop down menu
HuggieBear replied to mfaulkner's topic in PHP Coding Help
Having just read the post three times, I totally agree. Mfaulkner, I think your logic has gone awry somewhere along the line. Regards Huggie