-
Posts
26 -
Joined
-
Last visited
Never
About Simon Moon
- Birthday 10/31/1979
Contact Methods
-
AIM
ShimonMoon
-
MSN
simonmoon@passport.com
-
Website URL
http://talkbase.org/
-
ICQ
119716277
-
Yahoo
shimonmoonx
Profile Information
-
Gender
Male
-
Location
Canada, eh?
Simon Moon's Achievements
Newbie (1/5)
0
Reputation
-
Ok get the site to make the error, then instantly check the error log of apache and see what it wrote in the last few lines. That should give a further clue. If you want to talk to me on MSN or icq. fenway: keep the discussion to the boards!
-
PHP Parse error: syntax error, unexpected '=' in /home/carseyh/public_html/admin/create articles.php on line 38 there is something wrong there. Other than that the error log doesnt tell me much.
-
Or use a singleton as database object, then whenever you need the db in your class you say simply $db = Database::getInstance(); and you are using the exact same object all around, while not having to pass the db object all over the place.
-
Should do the trick if i made no typos. SELECT * FROM customers JOIN custcontracts ON custcontracts.CustID = customers.CustID JOIN contracts ON custcontracts.ContractID = contracts.ContractID JOIN custproperties ON custproperties.CustID = customers.CustID JOIN properties ON custproperties.PremID = properties.PremID WHERE customers.CustID = 11111111
-
If you can get a holed of the error_log of that servers apache, that would help, check for the latest entries, there is something awfully wrong there. Looks to me like PHP wasnt compiled right or a config error. You can see html pages on that host? PHP otherwise works fine?
-
Your table name is "1" ? Anyways, whats the exact error you get? Maybe some more details would be good. Like change this mysql_query("INSERT INTO `1` (`id`, `name`, `article`, `cat`, `type`, `author`) VALUES ('', '$name', '$articles', '$cat', '$type', '$username')"); into this $query = "INSERT INTO `1` (`id`, `name`, `article`, `cat`, `type`, `author`) VALUES ('', '$name', '$articles', '$cat', '$type', '$username')"; mysql_query($query) or die(mysql_error()." ".mysql_errno ()." ".$query); and post here what it spits out. As an additional thing you can add this to the top of the script, just after the <?php thing, and copy all the warnings and errors that one spits out too. error_reporting(E_ALL);
-
Also a possible more accurate thing of what you describe you want is this bit. http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html Maybe there is a better way to do what you want al together if you give more details on what you are working on.
-
From your example, i assume you want that for printing it out. I would simply do that in the script, by counting up the numbers and not in the database.
-
Chosing one field over another if it exists with same field name
Simon Moon replied to Simon Moon's topic in MySQL Help
Here is an SQL block that will create a table and data to test it with. CREATE TABLE `phrase` ( `phraseid` int(10) unsigned NOT NULL auto_increment, `languageid` tinyint(3) unsigned NOT NULL default '0', `phrasename` varchar(100) NOT NULL, `phrasecontent` mediumtext NOT NULL, PRIMARY KEY (`phraseid`) ); INSERT INTO `phrase` (`phraseid`, `languageid`, `phrasename`, `phrasecontent`) VALUES (1, 1, 'test1', 'test1 english'), (2, 2, 'test1', 'test1 german'), (3, 1, 'test2', 'test2 english'); In essence, it should never give out always 2 lines in a query. It falls back on English (language id 1) if it cant find it on the actual language. So the English query would look for language id 1, the German query for language id 2. In the English case, it returns phrase id 1 and 3, in the german, it returns 2 and 3, since "test2" is not translated into German yet, it spits back as default the English one. If you would make a third language, and query it with this, it would return only the english phrases because it has no translated phrases as of yet. -
Query the other table and put the result you need from there into a variable first.
-
[SOLVED] mysql query browser cant function well, why?
Simon Moon replied to zgkhoo's topic in MySQL Help
Sorry, no experience with xampp. You mean this, right? http://www.apachefriends.org/en/xampp.html -
CREATE DATABASE IF NOT EXISTS db_name Reference: http://dev.mysql.com/doc/refman/5.0/en/create-database.html
-
Chosing one field over another if it exists with same field name
Simon Moon replied to Simon Moon's topic in MySQL Help
Again, highly appreciate your time. I think this is very close to the solution but not quiet yet. SELECT pf.phrasecontent AS fallback, p.phrasecontent FROM `phrase` AS pf LEFT JOIN `phrase` AS p ON pf.languageid='0' AND pf.phrasename = p.phrasename AND p.languageid = '2' This works with one table, but, I also get things back i did not really want that way. It ignores both AND clauses, which also happens if I use two tables. I mean how can you get Mysql to overwrite a value in a result set? I did it before, I know it's possible, and this is the key to this problem. If you select from two tables or one table doesn't make a difference really, the end result is that you have two columns that are the same, and if both columns are set, it prefers one over the other by a default (mostly which one is written first in the query as table). The more I think about it, I get the feeling that the JOIN is the answer, but I can't lay my finger on the solution yet. Ideas on that overwriting principle? I mean there is even an example that does it: http://dev.mysql.com/doc/refman/5.0/en/join.html Look for "Here column a contains the values of t1.a." and the example just below it. Still playing around with it, but somehow I don;t get the results I am supposed to... -
Chosing one field over another if it exists with same field name
Simon Moon replied to Simon Moon's topic in MySQL Help
Btw i highly appreciate your inputs here. I did not express that really clearly, so wanted to make sure you don't see me as an ungrateful bastard Maybe you know of another place where I could find some help on this as well? I tried a couple, but mostly they seem dead. -
[SOLVED] mysql query browser cant function well, why?
Simon Moon replied to zgkhoo's topic in MySQL Help
Well, depends. Is this your own server? Is it hosted somewhere? Running windows/linux? It all depends on where the server is and what kind it is. You might have access through cpanel or the likes where you can set it up.