I am building a system for doctors and patients where the patients submit the type of the medical examination and the quantity of medicine they use. I want to be able to subtract the value of the …
Tag: php
MySQL not showing databases created in phpMyAdmin
I’m trying to build a database for my server in phpmyadmin but when I finish building it I can’t access it using PHP and it won’t show when I list the databases in MySQL. But when I create a database in mySql it shows up in phpmyadmin. Also I’m running phpmyadmin version 4.0.3, and theres a statement at the bottom
mysql selecting multiple rows that match array of ids
First of all: SELECT `key`, `value` FROM settings WHERE `key` = :base_url OR `key` = :google_analytics OR `key` = :site_domain Is this correct way of selecting multiple rows? Or is there a …
PHP Return ID[uniqueidentifier] after sql INSERT
Like the title says, I want the id of a row to be returned after INSERT to the database. I’ve got 2 functions, one to make a connection to the database: And one to insert a new record: I need the last function to return the ID of the inserted row, how should I do this? EDIT: Like the title
php/mysql: get data from one table, convert and insert in another table
Ok I will try to explain, (I am Portuguese lol). I have a Database where I have the fallowing MySQL: Database: ad Table: notebooks Fields: ID, tag, so, lastlogon, lastlogh My ldap query gets data from ldap server (active directory) and stores it in my MySQL database (ad/notebooks). I get tag which is tag number is unique. I get so
PHP SQL Views counter using PDO prepare()
I have a variable $id which gives me the id of the current article and this can help me to make an update query in my database on current article. This is my code: I don’t get any errors but my code is still not working… Answer Your correct code is here: ; from the end of sql is not
How do I get the query builder to output its raw SQL query as a string?
Given the following code: I want to get the raw SQL query string that the database query builder above will generate. In this example, it would be SELECT * FROM users. How do I do this? Answer To output to the screen the last queries ran you can use this: I believe the most recent queries will be at the
Get highest ids in by an inner join and max id
I got two tables, conversations and messages, What I’d like to do is to make a inner join from conversations to messages. Here is my query: SELECT messages.msg, messages.`read`, …
If pagename then run statment
I’m building a blog and have two tables articles and categories and I’m joining these tables, but what I want to do is display just the categories if I click a categories link. I’m passing the …
Problems with SQL syntax? MAX not working
postid is a increasing numeric value (1,2,3…). At the moment, the highest value is 49, but It’s pulling up 1. It seems to be ignoring the MAX statement. otherwise everything else is working great. Answer That’s not valid syntax, which engine is running it? You either need: to get multiple records, one for each title, showing the max postid for