Maq
Administrators-
Posts
9,363 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Maq
-
Same here. If you use ctype_alnum, it would be more difficult to modify than using a regex from the start. But, yes, in this case ctype_alnum, would be ideal.
-
Need another '}', the first one is for the while loop but you don't have a terminating curly for the if. } } elseif($username == '') {
-
Now the foreach for $supp_id_out is missing...
-
That means your query is failing. Did you change the other line as well? Could you post your current code?
-
session_start();s You have an extra 's' in test2.php, is that a typo?
-
Change this line to: (notice the dot) $query .= substr ($query, 0, -1) . ') '; You can get descriptive SQL error messages by changing this line to: $result = mysql_query($query) or die(mysql_error());
-
Oh I see. Many people tend to use backticks ` but they are only needed when you're using a reserved word for a table name or field.
-
Above this line: while ($row_cl = mysql_fetch_assoc($result_cl)){ You need to add: $supp_id_out = array(); And change this line to: $supp_id_out[] = $row_cl["supp_id"]; Without initializing $supp_id_out as an array, it will always be a string with the value of the last record that's pulled from the database.
-
Hmm, looks the same as before... At least it works now
-
Yeah I've seen a couple on these forums and a lot on Google. Here's one
-
6th instance, I only see 3... Sorry, I don't understand what that mean. Can you give an example?
-
Check out this basic tutorial: PHP and AJAX MySQL
-
Code?
-
- If your search did not get any results, and you click "search again" it would be nice it the fields were auto-populated with your previous criteria.
-
What's wrong with using something similar to what you had? $fp = "[Querying whois.arin.net] [Reirected to whois.ripe.net:43] [Querying whois.ripe.net]"; if (strpos($fp,"Redirected")){ echo $fp; } ?>
-
Like revraz said, you probably want $supp_id_out to be an array that's created from the while loop. Try changing this portion: $supp_id_out = array(); while ($row_cl = mysql_fetch_assoc($result_cl)){ $supp_id_out = $row_cl["supp_id"]; $qty_out = $row_cl["qty"]; } foreach($supp_id_out as $key => $value) { $qty1 = $qty_out; $pid = $key; // add to the cart session variable $_SESSION['cart'][$pid] = $qty1; }
-
[SOLVED] Replacing "Co.Kildare," with "Co.Kildare"
Maq replied to mikebyrne's topic in PHP Coding Help
$currentline=preg_replace('/(,\n)$/',n'', $test); -
Change this line to add whatever the column for their real name is: $LoginRS__query=sprintf("SELECT realname, username, password FROM users And add a session variable to carry the real name. //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; $_SESSION['MM_RealName'] = $LoginRS['realname']; On the page you would like to display the real name you can just use: echo "Welcome " . $_SESSION['MM_RealName']; As long as you have session_start(); at the top of your page.
-
That's because $supp_id_out is a string and foreach takes an array.
-
[SOLVED] Replacing "Co.Kildare," with "Co.Kildare"
Maq replied to mikebyrne's topic in PHP Coding Help
Add a '\n' after the comma in the regex and it will pick up the comma then newline. -
It's good to suppress errors on a production server, but when you're trying to debug then you want to see these errors so you can fix them.
-
That may be a problem, cause you need the processing script where it checks to see if their username and password match. Are you using some sort of template or third party script? They may have the username in the session already. If they do you have do something like this to see what session variables are set. session_start(); print_r($_SESSION);
-
[SOLVED] Replacing "Co.Kildare," with "Co.Kildare"
Maq replied to mikebyrne's topic in PHP Coding Help
This will get rid of any comma that is at the end of a string: $d = "D,2796,Son,OlerCo.Kildare,"; $currentline=preg_replace('/,$/','', $d); echo $currentline; -
You mentioned earlier that you stored their information in the DB when they registered. So, wherever you authenticate their username and password when they log in, grab their real name from the DB and store it in a session.
-
Try: $query = "SELECT t.*, c.* FROM cart_items i, cart_categories c ". "WHERE i.pn_cid=c.pn_cid";