-
Posts
837 -
Joined
-
Last visited
Everything posted by samshel
-
As Jesirose rightly pointed out, you dont need to fetch the existing field data in variable, explode it, attached new string at end and implode it again. since it is comma separated, you can just append it at the end. If you want to insert the text in middle of the field and sequence does matter then you will have to do what you are trying to do. $result = mysql_query("UPDATE users SET attack_out=CONCAT(attack_out, '".$attack_user."') WHERE username='$username'");
-
Agree with requinix...such big arrays will generally land into problems. however you can try using a SORT_FLAG with array_unique. Not sure, but worth a try. $stargate_address_arrays = array_unique($stargate_address_array, SORT_REGULAR); Also you can try your code for a lower values like 8000 to check if array_unique works as expected.
-
Adding popup calendar or 3 drop downs with day, month, year is the best way to go, avoiding any input errors or confusing the user to how to input the date.
-
Check this out : http://php.net/manual/en/function.eval.php Check out the bold warning in red as well
-
var_dump($_GET) to debug more and see if all query string variables are getting passed properly.
-
You cannot add / remove records after you retrieve them from the result set, that will screw up you paging. Example: Total 1000 records in table. First page fetches 0 to 25 irrespective of stock. After fetching from database, you hide 5 rugs which don't have stock. So you would be showing only 20 rugs on the page. This will differ with each page and the count of the records on one page will not be consistent. If you need to hide rugs with no stock, it is better to be done in the query. however as Psycho pointed out, if this is production code, then you better get someone to look at the entire code then fix it.
-
Agree with scootstah. Basic search can be done in a simple query with joins if necessary instead of 120-130 queries. The difference in page load times if some filter is applied may be because of indexes defined on your tables. Correctly defined Indexes play a huge part on the query execution time.
-
since you are getting this error even if you comment out the code...I am getting a feeling that this is not what is breaking.. There may be some other code below this which is breaking...just a guess.
-
add user_id != 1 to the query ??
-
If the var dump is of $_POST then the variables names are not matching. you are checking for $_POST['update1'] and $_POST has update. Also is the code you posted only code with query in your page? Is there any query below the code which might be breaking?
-
debuggin more is the only option. var_dump($_POST); move query to a variable $strSql = "UPDATE subcat SET parentid='$parentid', name='$title' WHERE id='$id1'"; echo $strSql; $result1 = mysql_query($strSql) or die(mysql_error()); From the error it looks like one of the post variables are not set correctly.
-
Of course you would need to do some excluding... This function is for internal decision making and not to display the results as is. Assuming most of the files you would want to exclude are common to all pages, you can show the third element from the array [just an example] as the parent page if first 2 elements are dbconnection and config files. It is totally up-to-you.
-
check if your query is failing: $result = mysql_query($sql) or die(mysql_error());
-
not sure if i understand...but try this. if(mysql_num_rows($result) > 0)
-
Check this out: http://php.net/manual/en/function.get-included-files.php
-
die() means exactly what it says... It will display a message and die. If you want to display a message and want user to perform some action, instead of die you can redirect the user to some other page and show message on that page. I would advise against use of back button or resubmit for a page that has Credit card transactions even if it is a failed one...
-
I might be wrong....but i am not sure if you escape a single quote, the slash will get stored in database. It just tells MySQL to not consider the single quote as a syntax but again i might be wrong.. mysql> INSERT INTO `temp` (last_name) values ('sam\'shel'); Query OK, 1 row affected (0.00 sec) mysql> SELECT * FROM temp\G *************************** 1. row *************************** last_name: sam'shel
-
Create a PHP file which accepts the download path as parameter. Link the download to this PHP file. the PHP file will increment the counter or do whatever action you want and then redirect to the download path.
-
r u redirecting to the same page? you can create a simple thank you page with no processes and redirect the user there...
-
try commenting out the header at the bottom and echoing out something to check if the header is causing the execution again.
-
SELECT box is HTML , you can JS which will will handle the population of text box or do any other action. PHP is a server side language and will provide you data for the drop box, but client side rendering is HTML and JS [if you use it].
-
Not sure if this is related to PHP. You can achieve what you want quite easily by using HTML + JS. If you want server side validations then you can use PHP.
-
what is the output ur getting?
-
insert a varchar data into mysql from a php date() function
samshel replied to wev's topic in PHP Coding Help
$year = date('Y'); echo $year; $insertSQL = "INSERT INTO tbl_elections (election_id) values ($year)"; mysql_select_db($database_organizazone_db, $organizazone_db); $Result1 = mysql_query($insertSQL, $organizazone_db) or die(mysql_error()); -
insert a varchar data into mysql from a php date() function
samshel replied to wev's topic in PHP Coding Help
you don't need to convert number to string to store in varchar. I think your insert statement needs to be updated: try this: INSERT INTO tbl_elections (election_id) values ($year)