mikosiko
Members-
Posts
1,327 -
Joined
-
Last visited
-
Days Won
1
Everything posted by mikosiko
-
How to append to values already in column.
mikosiko replied to theITvideos's topic in PHP Coding Help
validate if your ShippingId exist or not in your Shipping profile table... if exist do an update concatenating then old value with the new addition ... you don't need to implode anything in my opinion UPDATE ShippingProfile SET ProductId = CONCAT_WS('|', ProductId, $newproductid) WHERE ShippingProfile = $theprofile else do an Insert I don't like your design... but that is the gun that you chose ... and 200 hundred?... man you have a lot of tables -
maybe you can also consider other option like SwiftMail http://www/swiftmailer.org I've been using it for a time now and I like it very much.
-
starting with mjdamato code do this: add this lines ini_set("display_errors", "1"); error_reporting(E_ALL); immediately after the <?php line and fix what seems to be a typo error in this line mysql_query($query) ordie("Query: {$query}<br />Error:".mysql_error()); should be mysql_query($query) or die("Query: {$query}<br />Error:".mysql_error());
-
for a start PHP arrays elements numbering start at 0 not in 1, and that could be the reason for some errors for null you mean a blank screen or null result values ? add this lines to your code and test if you get some error : (if I'm guessing correctly about a second option for your errors maybe you could see a nasty error here ) ini_set("display_errors", "1"); error_reporting(E_ALL); // Produce the % array of each array for use in 2nd report $percent_morale1=percentCalc($morale_count1[1],$morale_count1[2],$morale_count1[3],$morale_count1[4],$morale_count1[5],$total_morale1); $percent_morale2=percentCalc($morale_count2[1],$morale_count2[2],$morale_count2[3],$morale_count2[4],$morale_count2[5],$total_morale2); $percent_morale3=percentCalc($morale_count3[1],$morale_count3[2],$morale_count3[3],$morale_count3[4],$morale_count3[5],$total_morale3); $percent_morale4=percentCalc($morale_count4[1],$morale_count4[2],$morale_count4[3],$morale_count4[4],$morale_count4[5],$total_morale4); $percent_morale5=percentCalc($morale_count5[1],$morale_count5[2],$morale_count5[3],$morale_count5[4],$morale_count5[5],$total_morale5); $percent_morale6=percentCalc($morale_count6[1],$morale_count6[2],$morale_count6[3],$morale_count6[4],$morale_count6[5],
-
define your aliases directly in the select... instead of this: $result=mysql_query("SELECT * FROM $table_name"); something like this $result = mysql_query("SELECT field1withbadname AS field1, field2same AS field2, field3other AS 'This Field', etc...etc FROM $table_name");
-
what do you believe this is doing? $query = "select * from people \"%$trimmed%\" order by FirstName"; also is good to include this lines at the beginning of your script... its will help you to find the errors that your code produce error_reporting(E_ALL); ini_set("display_errors", "1"); that is for a start... I didn't read the rest of your code, therefore I don't know if you have more errors in there
-
maybe worth to read... simple examples... you will get the idea http://devzone.zend.com/node/view/id/638
-
Trying to SUM() with a Where Clause and getting improper results..
mikosiko replied to kts's topic in MySQL Help
for a start... why are you using a WHERE clause WHERE crp.StudentID = q.StudentID AND q.Department = crp.Department if already you are doing that in you JOIN clause? FROM CredDetails q JOIN CountRegentsPassed crp ON (crp.StudentID = q.StudentID AND crp.Department = q.Department) clean that first... seems that you should also GROUP BY q.department, q.studenId -
possible for the same Region_name - City maybe example : http://www.zipcodedownload.com/~Resources/Images/USAZIP5Premium.gif I will run this query to find the records SELECT region_name, city, count(geocode_id) FROM `ip_geolocation` GROUP BY region_name, city HAVING count(geocode_id) > 1
-
that is not necessarily true according to Mysql manual in reference to sorting using the filesort algorithm: your sort_buffer_size is only 1 MB, therefore is possible than the sort is creating temporary chunk files... hence the answer from MCHL is perfectly valid... look for space limitations in your temporary file system
-
enable error_reporting set to E_ALL and display_errors set to ON and look for possible errors. error_reporting(E_ALL); ini_set("display_errors", 1);
-
using SUM() but having more than one table in SELECT
mikosiko replied to jwk811's topic in PHP Coding Help
here is a quick example for you to adjust to your tables... notice the way the tables are related using an INNER JOIN (in this case), and the GROUP BY clause allow you to give correct result for the aggregate function SUM SELECT P.productCode, P.productName, SUM(priceEach * quantityOrdered) total FROM orderdetails O INNER JOIN products P ON O.productCode = P.productCode GROUP by productCode ORDER BY total -
count the number of multiple showing variable in a column
mikosiko replied to Ryflex's topic in PHP Coding Help
good catch PFMaBiSmAd... is so natural for me to use aliases always that I didn't look for that detail -
count the number of multiple showing variable in a column
mikosiko replied to Ryflex's topic in PHP Coding Help
better if you post most of the code than you have... you last sentence is telling that you have more code that is been affected for what you are showing... without knowing/seeing the rest of the code is impossible to know what is happening in reality -
if you are trying to search looking for exact match you should not be using LIKE your results are not inaccurate... they are exactly what are you asking for using the LIKE clause with the % pattern at the beginning/end...
-
this part of your code doesn't make too much sense.... ; //Find newest post and find what thread it is from $lastPost = mysql_query("SELECT * FROM `posts` ORDER BY `posts`.`postCreated` DESC") or die(mysql_error()); while($lastPostReturn = mysql_fetch_array($getSubCatagory, MYSQL_ASSOC)){ echo $lastPostReturn; } //Grab User and thread number and date $lastPostUser = $lastPostReturn['postUser']; $lastPostCreated = $lastPostReturn['postCreated']; $lastPostEntry = $lastPostReturn['entryID']; seems that you want just the latest post, therefore your select should use the LIMIT 1 at the end... and also your WHILE is using the $getSubCategory instead of $lastPost... on top of that is you are retrieving only one $lastPost you don't need a WHILE loop at all... you can use just a $lastPostReturn = mysql_fetch_assoc($lastPost) for a final code like this: //Find newest post and find what thread it is from $lastPost = mysql_query("SELECT * FROM `posts` ORDER BY `posts`.`postCreated` DESC LIMIT 1") or die(mysql_error()); $lastPostReturn = mysql_fetch_assoc($lastPost); //Grab User and thread number and date $lastPostUser = $lastPostReturn['postUser']; $lastPostCreated = $lastPostReturn['postCreated']; $lastPostEntry = $lastPostReturn['entryID']; after that part... your next WHILE //Find the title of the thread and generate URL\ $lastPostThread = mysql_query("SELECT * FROM `entry` WHERE entryID = '$lastPostEntry'"); while($lastPostThreadReturn = mysql_fetch_array($lastPostThread, MYSQL_ASSOC)){ } is also wrong... nothing inside of the WHILE loop, therefore why use it ?... the solution is the same as before if you are recovering just 1 record.... hope this help
-
and for other circumstances you can use heredoc or nowdoc syntax when neccesary. http://php.net/manual/en/language.types.string.php
-
Delete album and items related to the album HELP
mikosiko replied to Lisa23's topic in PHP Coding Help
write that in your constants.inc.php file and test if you are defining it in the caller page the constant is "unknown" in your delete page -
and why you need to do that with a "tool" ?
-
Delete album and items related to the album HELP
mikosiko replied to Lisa23's topic in PHP Coding Help
litebearer I didnt quite understand what u talking about which line?? again.... with the due respect for litebearer contribution.... stick with the code that you have now -
Delete album and items related to the album HELP
mikosiko replied to Lisa23's topic in PHP Coding Help
that should be there... but hard to tell you which value it should have because we don't know the whole system. either you can define it with any value and test what happens or analyze the code completely and try to understand how it work.. from that understanding you should be able ti figure out what value that constant should have... by now your original script is working and the message that you are getting is just a NOTICE. -
Delete album and items related to the album HELP
mikosiko replied to Lisa23's topic in PHP Coding Help
THIS_SCRIPT is no defined in that code.... check if it is defined in one of the include files .. probably in the constants.inc.php file and disregard my previous suggestion... THIS_SCRIPT most likely is a constant not a variable. -
Delete album and items related to the album HELP
mikosiko replied to Lisa23's topic in PHP Coding Help
so the code that we were working on is working fine ... good this is a different problem.. as we don't know what do you have in your common.inc.php we can only guess what the problem could be... try changing THIS_SCRIPT for $THIS_SCRIPT in all the places. otherwise, post your common.inc.php code -
that is a very wide brush to paint the water.... IMHO
-
just a wild guess... the user that is experiencing the error... how is he accessing the site? ... I imagine something like this http://<name of the host here>/index.php test that user using this http://<ip of the host here>/index.php and see if that make a difference