
eMonk
Members-
Posts
223 -
Joined
-
Last visited
Everything posted by eMonk
-
Sorry, I read the question wrong.
-
You can do this with $_POST $time = trim($_POST['time']);
-
How to display data according to dynamic list box
eMonk replied to rabesh's topic in PHP Coding Help
You can use $row[table_column] to display the data in a list box. -
Ok, thanks for confirming requinix.
-
Should I be using a different mysql connection for users visiting the page. For example, just give them SELECT access? Right now I'm just using 1 connection which is the admin user with all grants. I haven't made a members area yet but when I do new member accounts will only be grated with SELECT and UPDATE. I don't recall having to config 2 connection types when installing php/mysql scripts in the past but just want to make sure.
-
Convert text to link which retrieve from database
eMonk replied to jgkgopi's topic in PHP Coding Help
echo "<a href='main.php?name=" . $row['name'] . "'>" . $row['name'] . "</a>"; -
I've read it's bad to use php and other web applications to backup mysql databases (for big sites). If it timeouts the file becomes corrupt. Backing up via SSH seems more solid. Backup via SSH: mysqldump --opt -u user -p dbname > {path}/backup.sql Restore via SSH: mysql -u user -p dbname < {path}/backup.sql
-
When would you use mysql_close or mysql_free_result and why? Right now I'm ending my connections with mysql_close() but when would you use mysql_free_result? I read the php manual online for these 2 functions but still can't wrap my head around when to use which or if I should be using both.
-
You can enclose the html code with any of the following tags: <pre> </pre> <xmp> </xmp> <textarea> </textarea>
-
$insertGoTo = "<a href=\"index.php?id=$sbnineseven\">Link</a>
-
Are you trying to make index.php a link? There's no need to put php into php.
-
I'd fetch the table info from mysql then use: <option <? if($row[column] == 'value') { echo "selected"; }?>>Value</option>
-
Here's some sites that can help you get started: http://www.tizag.com http://php.about.com http://www.w3schools.com Here's a site where you might find examples of what you're looking for: http://www.hotscripts.com
-
I'm new myself and would suggest buying a php/mysql book to at least the basics. There's a bunch of exercises you can find online too.
-
I made model_id and city_display as the primary key without errors and it can be unique in one row in the table. Thanks for the wealth of info gizmola! It makes sense now.
-
Actually, looks like you can: http://dev.mysql.com/doc/refman/5.0/en/select.html The first comment there might help you:
-
I'm new to mysql as well... I don't think you can have a sum function in a query like that. Maybe something along the lines of: $sum_1 = sum(quantity*price) and remove "sum(quantity*price) as value2" from $query2.
-
Also, what happens when you use primary keys incorrectly like I just did. This table appears to be working without any known problems. I've been inserting, selecting, deleting, etc from this table fine...
-
Actually, I think model_id and city_display can be the primary key...
-
I don't think I have any primary keys in this table then. Would it be ok to not have a primary key in this table?
-
model_id is the only unique column in the table. I had to use multiple inserts with the same model_id. So it's no longer unique? Should I remove the primary key from this as well and have no primary keys in this table?
-
How can I remove the primary key for city_id? I tried to remove it in phpmyadmin but got this error:
-
Oh, I see thanks gizmola.
-
Field Type Null Key Default Extra model_id int(10) unsigned NO PRI city_id int(10) unsigned NO PRI 0 city_display tinyint(2) unsigned YES NULL
-
I tried the following alter query but phpmyadmin still shows "No" under the Null column. ALTER table model_in_city Modify city_id int unsigned null; Also tried changing it in phpmyadmin and picked "null" from the dropdown menu but it's still displaying as not null. Any ideas?