-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
could you show your actual current query?
-
ROFL! that just brightened up my morning!
-
Hi all. I was looking through some old code and found some pages for a year or so back. In one of the pages there are a couple of SQL queries run from within the while loop of another query. I had to do this mainly because the first query is a SELECT query that is run against an MS SQL Server on what I will reffer to as "Host_A", and the queries run from within the while loop of this result set are running INSERTs agains a MySQL Server that I'm going to call "Host_B". Now Host_A and Host_B are two different physical servers, Host_A was WinServer 2003 and Host_B was CentOS Linux distro' (used as web front end due to the owners only having 5CAL's for the WinServer). Both are on the same network (not that I think that makes a difference). I just got to wondering - As I'm not a fan of querying within a query in this nature - Is it actualy possable to code a connection to both Host_A and Host_B simultaneously running a single query using both types of DB server? -- I assume "not at all" will be the answer, given that mssql_query() and mysql_query() are different commands. Just thought I would ask the question on the off chance that someone knows of a way (in case I ever come accross this type of scenario again...I like to prepare for the worst ) Let me know your thoughts. Cheers.
-
could you post your form up please? also, have you used the w3c validator on your pages? - if there are any browser specific issues that generaly tells you what they are.
-
You could try running stripslashes() on the array output before using the mysql_real_escape_string()
-
insert and query with words and numbers
Muddy_Funster replied to chrispos's topic in PHP Coding Help
- the OP asked for help in structuring the tables to best store the information, nothing to do with syntax or the use of WHERE. Are you new?....oh wait - yes you are, people do this all the time, if you don't like it: move on. The OP isn't asking YOU, he's asking everyone. How exactly is he asking for help on a forum with no written text If you can't post something productive there are others that will, you're not long here so if you don't actualy WANT to help: move on and stop bashing on people. @ the OP - post up all the information that you think you are likely to need to hold in the database, then we can give you some pointers (and please start posting in the correct sections of the forum, this is nothing to do with PHP) From the information that you have given I would stringly suggest that you use a field for "subject" and another for "grade", Though there may be other considerations, so if your unsure give us it all. @ a mod - move to MySQL Help? -
this is back to front... ("INSERT INTO customers ($firstname, $lastname, $doornumber, $street, $town, $postcode, $useremail, $telephone) (firstname, lastname, doornumber, street, town, postcode, useremail, telephone) ") should be ("INSERT INTO customers (firstname, lastname, doornumber, street, town, postcode, useremail, telephone) VALUES ($firstname, $lastname, $doornumber, $street, $town, $postcode, $useremail, $telephone) ") The others have already told you that you need to put your input strings inside quotes.
-
Column count doesn't match value count at row 1
Muddy_Funster replied to sunilpaladugu's topic in MySQL Help
is id auto incrament? have you echoed out the values from $query_row[id] and $query_row[name]? Could you post your full php code please? -
you can't post anything that's not in the form - even a datavase result value : $row=$_POST[$row['game_id']; won't work. you will need to make a hidden field on your form and assign it this value to take it through with the post command. alternativly parse it in the URL header and use a $_GET[] to retieve it. I assume if you use a static value for game_id then it works ok?
-
how about adding a hidden field to your form, naming it "refresh" and giving it a value of "1". Then at the top of the page : $refresh = $_POST['refresh'] if ($refresh == 1){header( "refresh:5;url=wherever.php" ); echo 'You\'ll be redirected in about 5 secs. If not, click <a href="wherever.php">here</a>.'; $refresh = 0; } would that do the trick?
-
Strangest error ever...commenting falls the php script
Muddy_Funster replied to paasikivenpieru's topic in PHP Coding Help
does it do it with block comments as well or just the in line comment? -
"those slanted ones" are called backticks, and allow you to use reserved words as table/field names without MySQL getting all upset with you. I have never tried to make a field name with any of those characters in it - and to be honest, I can't think why you would even want to (but then I can't think why you would want to cram what is clearly at least four tables worth of information into one either). I would recomend that you just don't do it.
-
PHP is OOP?
-
Linking related table data with php/mysql
Muddy_Funster replied to cjkeane's topic in PHP Coding Help
problem here is the SQL VALUES ('communications.CommID', CURDATE(), NOW(), '$Notes')") or die(mysql_error()); you can't just tell point it at a table field and expect it to know what it's looking for (or even what it's looking at) try this and let's see how you get on VALUES ((SELECT DISTINCT commid FROM communications where communications.IDNumber = '$IDNumber' LIMIT 1), CURDATE(), NOW(), '$Notes')") or die(mysql_error()); But the biggest problem is that you have error reporting turned off in the php.ini file. -
Sorting a list of products by the product name and then the type
Muddy_Funster replied to j.smith1981's topic in MySQL Help
OK, now I get a look at it, this looks more like what you want: ORDER BY SUBSTRING(name, (INSTR(product, ' '))) DESC, product ASC -
If you are actioning the transit between pages with a form you can add your $query variable to a hidden field in the form, and catch it with $_POST on the other side. alternatives would be to use a session variable to pass the data, or to use URL passing and $_GET to retieve it on the second page
-
You will need to do one of either 2 things: re-submit the page each time a new selection is made along the chane, using an independant form for each stage and some conditional execution options ...or... take up javascript and run each sub querie through the OnChange/OnBlur events.
-
Sorting a list of products by the product name and then the type
Muddy_Funster replied to j.smith1981's topic in MySQL Help
If you could give me a sample of the exact data in the products field we could work on this. as the problem with the last result set was inconsistancy in the data (one had a space between product and 1 and the other did not). -
yeas, if you want it to actualy validate the input from the form you will need to use the field names from the form. What you are doing is telling the program that IF 'variable name' IS NOT assigned THEN BEGIN assign 'variable name' TO 'fixed value' END IF ELSE BEGIN assign 'variable name' TO ITS SELF END ELSE As such, it won't matter what you use here, it will assign what you tell it to the variable that you tell it. This is regardless of if that variable has any relation to the data entered or not. You really shouldn't be manualy assigning $_POST[] variables anyway. you should be using local variables for everything that you are assiging through the code (i.e. everything to the left of a single = sign)
-
You are welcome, glad you got it sorted out. (mark as solved now?)
-
Help with inline editing mysql search results
Muddy_Funster replied to jvance38's topic in PHP Coding Help
it's not in that code, it's in the code of both the edit and delete pages, and it will need to be before you do anything with the data from the database, so the page knows what row it is to effect. You will need to change that line of code you have highlighted to point to your existing edit and delete pages (change the dbEdit.php and dbDelete.php to what your pages are actualy called) -
use echo '<input type="text" name="fieldName" value="'.$var['fieldName'].'" />'; to populate the form fields on page load.
-
OK, well all I can suggest for books on PHP/MySQL is "PHP and MySQL For Dummies 2nd EDT" (although I would guess it's on the 4th or 5th EDT by now) It walks you through the basics of setting up php and mysql functionality. I would only use it as a starting point though, it is just the basics. Further than that, have a look at some of the guides here at phpFreaks, there are is a lot of good content published by a lot of very skilled people. and the php online manual(as has been suggested already) is the best reference you'll come across, although confusing as hell if you don't know what your looking for and have no experience with the language.
-
Sorting a list of products by the product name and then the type
Muddy_Funster replied to j.smith1981's topic in MySQL Help
Without some sample data there's not much more I can do, sorry. -
Good Point There Cyber, Chandler, add a line, above the mail() function to assign your chosen email address to $replyemail $replyemail = "[email protected]" mail(....