802 Posted Topics

Member Avatar for eawade

Strange indeed. Run a complete log (change the logging configuration in my.ini and restart the server) to see where and why the update occurs. Do you have any active triggers which do anything the the user table?

Member Avatar for smantscheff
0
217
Member Avatar for Cuchara2

I did not study the code thoroughly, but noticed this assignment [CODE]if ($check2 = $thenumbar)[/CODE] which should probably be a comparison instead [CODE]if ($check2 == $thenumbar)[/CODE]

Member Avatar for smantscheff
0
149
Member Avatar for Venom Rush

It's a question of security. If all domains share the same mysql user you have to define this user's access right's to the database only once. This makes it more manageable that a bunch of users, especially since mysql does not have a concept of user groups. If all domains …

Member Avatar for smantscheff
0
92
Member Avatar for shinysherbina
Member Avatar for rajeesh_rsn

Your problem is bad database design. By which value would you like the aggregate row with idNo 12 to be sorted - 12, 13, or 14/02/2011? You cannot have distinct rows as a GROUP BY result and at the same time retrieve the non-grouped values separately. The non-grouped values disappear …

Member Avatar for crishjeny
0
126
Member Avatar for NinjaLink

How do you decide if a clause is needed in a query or not? If you have a rule for that, you can code it. But from your example this rule would have to rely on semantic knowledge rather on formal aspects of the query.

Member Avatar for crishjeny
0
112
Member Avatar for Josef01

[QUOTE]Just understand this code that how it works and your problem will be solved- [/QUOTE] Of course you will have to check first if the table already exists, maybe include a DROP TABLE statement, sanitize the input so that no malicious user can compromise or erase your whole database, and …

Member Avatar for Josef01
0
381
Member Avatar for labhijitp

Use two queries and bracket them into a transaction. That makes them from a logical and database point of view only one query in two chunks. If you don't like that, use this inefficient solution: [CODE]UPDATE runquery.table1, runquery.table2 SET runquery.table1.`Column1` = if(itemid=3,(runquery.table2.`Col1`/runquery.table2.`Col2`*100),Column1), runquery.table1.`Column2` = if(itemid=5,(runquery.table2.`Col1`/runquery.table2.`Col2`*100),Column2) where runquery.table1.`Userids` = runquery.table2.`userid`; [/CODE]

Member Avatar for labhijitp
0
223
Member Avatar for 54uydf

Write a script which imports all CSV data into a separate database. Use the mysqlimport command line utility for that purpose. Then write an SQL script which compares the imported CSV data with the data in place and updates them as necessary. Store this script as a stored procedure so …

Member Avatar for smantscheff
0
131
Member Avatar for wingmark

To prevent illicit downloads you have to protect your files on the server level. Otherwise any wisecrack who can guess how a link looks like will be able to download. Tur2tlive's solution is dangerous because it makes you believe that your data are safe while they are definitely not. To …

Member Avatar for Ezzaral
0
204
Member Avatar for professor123

You can't do that in PHP. Log the submissions to a text file and view it with [ICODE]'tail -f theLogFile.txt'[/ICODE] from a console window (assuming you are using linux).

Member Avatar for tomato.pgn
0
119
Member Avatar for lovell_82

What syntax error do you get? I assune it's because the column names in your query are bracketed in apostrophes, which the should not be. Try instead: [CODE]mysql_query ("INSERT INTO members(ID,Name,Surname,Phone,Email,Cemail,Username,Password,Cpassword) VALUES (NULL, '$Name','$Surname','$PhoneNo','$Email','$Cemail','$Username','$Password','$Cpassword'") or die (mysql_error()); [/CODE]

Member Avatar for lovell_82
0
144
Member Avatar for stevija

Bracket the whole order process with START TRANSACTION and COMMIT respectively ROLLBACK in case of any errors.

Member Avatar for stevija
0
226
Member Avatar for jlego

Maybe there is a mysql process still blocking the 3306 port. Restart the machine or kill this process (if you find it). I don't know how close MacOS sticks to its ancestor linux. With linux the advice would be, look under /var/log/messages to find info as to why mysqld would …

Member Avatar for jlego
0
224
Member Avatar for aadebayo

Your query makes no sense, since it is an union of a set and a subset of this set. This query will always return the whole set - the entire view. The desired result makes no sense, either. What are the selection criteria so that user 1 (Ademole Adebayo) shall …

Member Avatar for peter_budo
0
193
Member Avatar for extemer

If you do not specify an AS clause in your field content description, the row index will be the same as the content description itself. But your query does not make sense in the first place. Test it against your database without PHP (from the command line) and you will …

Member Avatar for smantscheff
0
100
Member Avatar for simransuri

[QUOTE]how to do this[/QUOTE] Don't. Do not store calculated values in your database. If Hra and DA are percentages of another database field, create a view which calculates them instead of storing them.

Member Avatar for smantscheff
0
102
Member Avatar for 650U

Use the mysqldump command line tool. You need something like [ICODE] mysqldump -u[I]user[/I] -p[I]password[/I] [I]database[/I] --tab [I]filename[/I][/ICODE] See mysqldump --help for a complete option list.

Member Avatar for debasisdas
0
139
Member Avatar for amit.hak50

Use a javascript OnKeyUp() function. You cannot do it in PHP without a submit.

Member Avatar for smantscheff
0
110
Member Avatar for divyakprabh

Make sure that your query is using indexes. What does "EXPLAIN <your-update-query>" tell you?

Member Avatar for smantscheff
0
68
Member Avatar for klemme

1. What does "The last query doesn't work" mean? Do you get an error message or what? 2. Isolate your problem and present exactly the query which does not work and tell us in which way it doesn't work. 3. The clause "WHERE position <= $position AND position <= $position" …

Member Avatar for smantscheff
0
114
Member Avatar for dyingatmidnight

Use the "text" data type to store long texts. If you are stuck with the varchar type you can either store longer texts in external files and store the file names in the database, or you can set up a system of linked varchar entries which you concatenate to get …

Member Avatar for dyingatmidnight
0
121
Member Avatar for alenD

Quote from [url]http://stackoverflow.com/questions/658937/cache-re-use-a-subquery-in-mysql:[/url] [QUOTE]See what EXPLAIN EXTENDED says. If it says DEPENDENT SUBQUERY or UNCACHEABLE SUBQUERY, then it will be reevaluated each time it's used. This happens if the subquery uses session variables or is a correlated subquery. If it doesn't, it most probably will be cached. [/QUOTE]

Member Avatar for smantscheff
0
205
Member Avatar for sas1ni69

[CODE]SELECT Course.courseID,courseName,courseInstructor,if(103 in (select studentID from studentLink s where studentID=103 and s.courseID=Course.courseID),103,NULL) as ID from Course; [/CODE] There must be a better solution, but I'm too tired. Have a look at the EXISTS clause in select statements.

Member Avatar for sas1ni69
0
124
Member Avatar for klemme

You have to do it in several steps: 1) Check if there is a link with position 2 in the database. 2) If it is, [ICODE]UPDATE pages SET position=position+1 WHERE position >= 2[/ICODE] 3) Now do your INSERT query

Member Avatar for smantscheff
0
178
Member Avatar for gulbano

MySQL has a date type called timestamp which records the time of the last update of a row. Add such a field to your table. This field changes with every update, though. If you want to keep the insertion time, use a datetime field and a trigger which updates this …

Member Avatar for debasisdas
0
117
Member Avatar for gulbano

You can group the whole query by the team.id and use the count function on this aggregate. For further help submit the explicit data structures and your query.

Member Avatar for smantscheff
0
73
Member Avatar for BrianDickson

Use the one which you understand better. From the MySQL point of view it makes no difference.

Member Avatar for smantscheff
0
170
Member Avatar for rhuffman8

Use standard input/output direction from the console window. If your script resides in myscript.sql and your output should go in output.txt, enter [ICODE] mysql -u[I]username[/I] -p[I]password[/I] [I]database[/I] < myscript.sql > output.txt [/ICODE] on the command line.

Member Avatar for smantscheff
0
185
Member Avatar for rohit b k

Depending on the situation it might be more efficient to use the substring() function in the database query: [CODE]$result = mysql_query( 'select substr(myfield,1,10) from mytable' );[/CODE]

Member Avatar for diafol
0
132
Member Avatar for Mike Bishop

[CODE]CREATE PROCEDURE ClaimTotal @Result varchar(50) OUTPUT as select sum(total) [COLOR="Red"]into Result[/COLOR] from claim[/CODE]

Member Avatar for Mike Bishop
0
112
Member Avatar for jfunchio

You have to define the referenced (foreign) tables first before you can define a table which contains a foreign key. So create the rental tables as the last one.

Member Avatar for debasisdas
0
253
Member Avatar for madgokuss4

go along those lines: [CODE]$q = mysql_query( 'select * from stock' ); while ($object = mysql_fetch_object($q)) { if (mycheck($object) < 3) echo "sell at once $object->ticker!"; }[/CODE]

Member Avatar for madgokuss4
0
97
Member Avatar for newbie14

Set up one table for vehicles, one for tyres. Add a "position" column to the tyres table. Establish a 1:n relation from vehicles to tyres. Set up a unique index on vehicle_id and position in the tyres table to avoid duplicates.

Member Avatar for smantscheff
0
132
Member Avatar for Tehim

How do you keep track of your members? Via mysql or another database? Or with plain text files? Or are they system users?

Member Avatar for MagicMedia
0
362
Member Avatar for youvi

Your example is too scarce to give a general solution. Do all your entires look like "xxx_yyy"? Do you want to search only the part before the underscore? Then use the mysql substr() and locate() function to isolate that part and apply the like operator on it.

Member Avatar for Stefano Mtangoo
0
100
Member Avatar for mohansinhf

It's quite unclear what you want. Do you want all records with a field_id=1? Then just select them. Or do you want all records in which a text field contains the string representation of the number 1? In this case use a regular expression: [CODE]select * from mytable wher field_id …

Member Avatar for mohansinhf
0
82
Member Avatar for RJ_Dev

You have to grant privileges separately to any localhost users. By default there is a rule in the privileges table which denies all privileges to any user at localhost. To grant privileges to localhost users you have to grant them explicitly with "GRANT ... TO `someone`@`localhost`". And don't forget the …

Member Avatar for aawisdom
0
501
Member Avatar for debasishgang7
Member Avatar for debasishgang7
0
136
Member Avatar for TechySafi

Do it in an orderly fashion with one table for users, one table for permissions, one table which links both and a group_concat function which helps you with your string search. If you stick with your solution, just do a preg_match for '/(^|,)mila(,|$)/' in row 2 to check if mila …

Member Avatar for TechySafi
0
53
Member Avatar for chrishea
Member Avatar for Venom Rush

@debasidas: The question was not how to code a partition but about the behaviour in absence of such explicit coding - which I would also like to know.

Member Avatar for debasisdas
0
211
Member Avatar for ebanbury

MySQL wildcard comparison needs the "like" operator: [CODE]if ($_POST[district_zone] == "0") { $receivezone = [COLOR="Red"]"like '%'"[/COLOR]; } else {$receivezone = [COLOR="Red"]"= " . $_POST[district_zone][/COLOR];} $query_rs_district = "SELECT property_districts.district_zone, property_districts.district_name FROM property_districts WHERE property_districts.district_zone '$receivezone' ";[/CODE]

Member Avatar for ebanbury
0
87
Member Avatar for bengarbi

You're barking up the wrong tree. Try to build a query which contains all data to be displayed and then loop through it. Do not use 5 queries - it makes your code illegible. And regarding your code style: avoid redundancies. If mysql_query() goes with "or die..." whereever it occurs …

Member Avatar for bengarbi
0
129
Member Avatar for Acute
Member Avatar for smantscheff
0
94
Member Avatar for jrotunda85

Try another interface than phpMyAdmin, e.g. command line mysql. I assume that phpMyAdmin twiddles your query. Look in the server log what the actual query is which the server complains about.

Member Avatar for jrotunda85
0
114
Member Avatar for slrobinson1983

<?php $query= "SELECT * FROM table"; $result=mysql_query($query) or die(mysql_error()); $num_rows = mysql_num_rows($result); if($num_rows > 0) { echo "<table>"; while($row = mysql_fetch_array($result)) { [COLOR="Red"]$num_rows--;[/COLOR] echo "<td>" . $row['data'] . [COLOR="Red"]($num_rows > 0 ? "," : "")[/COLOR] . "</td>"; } echo "</table>"; } ?>

Member Avatar for diafol
0
105
Member Avatar for adamworld

Make sure that you have an index for all search criteria. And combined indexes for combined search criteria. Let MySQL EXPLAIN your query to optimize it. Add more RAM to your server. Increase the key buffer and other cache variables in my.ini.

Member Avatar for debasisdas
0
264
Member Avatar for senthamilgsa

If you have wamp installed you can run php from the command line. In my system it's c:[ICODE]\xampp\php\php <filename.php>[/ICODE] You won't have any server variables or HTTP properties like cookies, though. If you can run it that way but not under apache, then probably apache is not configured correctly. Check …

Member Avatar for smantscheff
0
189
Member Avatar for XxPKMNxX

You have to establish a connection first with mysql_connect(). Try [CODE]$rst = mysql_query($sql) [COLOR="Red"]or die(mysql_error())[/COLOR];[/CODE] to learn more about the problem.

Member Avatar for XxPKMNxX
0
250

The End.