
accident
Members-
Posts
43 -
Joined
-
Last visited
Never
Everything posted by accident
-
Or try using the REPLACE function, It will insert a new row if one doesnt exists, if it does exist it will update it
-
this would be much better $sql = "SELECT * FROM girls WHERE stage_name LIKE 'A%'"; Actually, taking a quick look, it looks like the database optimizes the query to execute as the same as mine. But generally the LIKE statement is a bit better performance wise
-
how to enter one row record from more than 1 input fields
accident replied to mizraabi's topic in MySQL Help
uhhh create more then one column in your table? This is the most basic database question.. I HIGHLY recommend you read up on databases. Create a table with the fields you need, then when you insert do INSERT INTO whatever VALUES(firstname,lastname) etc... -
by instead of doing * select your field names so if you have 2 tables and both have a name column you would do SELECT this.name as thisname, that.name as thatname ... etc you can obviously change thisname and thatname to be whatever you want it to be
-
yes as mbeals said, use php my admin, it is really easy. You would format your excel document to be in columns the following way email, lastname, firstname, blank The fourth column leave it blank Now save the excel document as a CSV file. in phpmyadmin go to import, click on CSV using LOAD DATA Then set the correct values for the fields, so Fields terminated by would probably be a comma , Fields enclosed should either be double quotes or empty depending on how excel saved the file. and then it should import fine.
-
oh sorry I was basing it off of your where statement where it shows 1 month If you run it at end of week for last 7 days try WHERE t1.dateline <= CURDATE() and t1.dateline >= DATE_SUB(CURDATE(), INTERVAL 1 WEEK) AND t4.title<>''
-
[SOLVED] Mysql is rounding up my currency values problem
accident replied to geroido's topic in MySQL Help
actually use decimal, never use float for currency. So for example decimal(10,2) -
in the SELECT query part add this quantity * cost AS ext_cost, quote_price * quantity as ext_quote as 2 columns
-
Yes, this is what the BLOB data type is for. Or you could base64_encode it to a varchar/text field but this takes more space. So set up a field as a BLOB type, read the contents from the image file as binary and insert the contents into the blob field
-
SQL doesnt use == just one = Second of all, doing a command on a column in the where clause is generally a very bad thing,, as it cannot use indexing so it will be very slow (although I suppose if you only have a few dozen rows you won't notice it) but if you are expecting to get hundreds of thousands of rows, this will be very slow
-
I am not 100% sure I get what you are saying, but what I think you want to use is LIMIT So for page one you would do SELECT whatever FROM table WHERE keyword='Something' LIMIT 5 This will return only the first 5 results For second page you would do SELECT whatever FROM table WHERE keyword='Something' LIMIT 5,5 This will start at the 6th row and return the next 5 rows.. So row 6-10
-
Switch the WHERE statement with this one WHERE t1.dateline >= CURDATE() and t1.dateline < DATE_ADD(CURDATE(), INTERVAL 1 MONTH) AND t4.title<>''
-
Databases are meant for storing millions of records. Like the person above said, if you are running your database on a VERY old machine, you may want to upgrade it, but if you are running it on a newer machine it will have ZERO problems with this. If you REALLY want to reduce the records you could just create an archive table, so you only keep the last years records in the main table, and anything older in another table. Just make sure you have indexes set up on the correct columns and you wont notice a problem Try inserting in two years worth of records and see how it performs.. it should be very fast. I mean you are only inserting ~1.5million records per year
-
[SOLVED] Help with Prepared statements and escaping
accident replied to accident's topic in MySQL Help
Never mind, I am retarded... apparently magic quotes is turned on for this server.... Guess I will disable it in htaccess -
[SOLVED] selecting dates between now and 31 days later
accident replied to digitalgod's topic in MySQL Help
err should be start >= CURDATE() -
[SOLVED] selecting dates between now and 31 days later
accident replied to digitalgod's topic in MySQL Help
you forgot to add in the check for greater then today... so shoudl be SELECT id, main_image FROM events WHERE member_id = '$_SESSION[members_id]' AND DATE_ADD(CURDATE() ,INTERVAL 31 DAY) >= start AND start > CURDATE() -
It will default to one on your first insert unless you run this command on your table ALTER TABLE tbl AUTO_INCREMENT = 1000 which will start the value at 1000 instead of 1
-
Just throw in a null and that will auto increment so for example INSERT INTO table VALUES (null, '$file', '$title', '$course', '$date', '$directory')
-
Hello, I just started using prepared statements with mysqli class. Anyways, I have code like this $stmt = $sql->prepare("INSERT INTO survey VALUES (null, ?, ?, ?)") $stmt->bind_param('sss', $_POST['name'], $_POST['address'], $_POST['product_purchased']); The first field is ID auto increment, rest are string fields. However if one of the fields I enter an apostrophe it gets escaped in the database with a slash \ so for example didn't would be stored as didn\'t I thought prepared statements are suppose to get rid of this? Is there any way to change this without calling strip slashes, or real escape string on every field? Thanks
-
Hello, I migrated my PHP install to a new linux ubuntu samba server (previous was just a debian server), in the process I also upgraded from version 4 to version 5. Anyways, I have a script that checks if a file exists, then reads from the file. This script always used to work fine but now have a problem. I have all filenames stored in a database lower case. when I do a check to see if a file exists, it says it exists, but then when I try to read from the file, I get an error thrown saying the file doesnt exist. I have narrowed down the issue to be that the file_exists seems to be case insenstive but file_get_contents does seem to be case senstive. Anyway to resolve this error? I know of a few ways I could do this (such as get a directory listing of all the files, and create a map between the lower case file names and real case file names). But wondering if there is another way to solve this issue since this could pose a problem in other scripts to
-
PHP5: How to ignore "<?" errors (scripts without "<?php")
accident replied to guarriman's topic in PHP Coding Help
So what, because some people use XML they remove it for everybody? I have never used XML once because I never had to. All our applications are database driven. It would break pretty much all of our scripts if they removed it. (although not really hard to make a regular expression to replace all short tags with long tags) I can see having the flag, which is fine, but if they remove it completely... I personally would think it is retarded. -
PHP5: How to ignore "<?" errors (scripts without "<?php")
accident replied to guarriman's topic in PHP Coding Help
Ok, maybe I am missing something, but why the hell would they remove short tags? Why do they care if I use <? vs <?php ???? If they remove short tags they are pretty damn stupid. -
Getting, saving, displaying and editing data.
accident replied to Braveheartt's topic in PHP Coding Help
no. You need PHP or another language installed. The majority of web hosts have php installed... are you sure yours doesn't? -
ah ok ... not sure why I thought you did. sorry