Simpler method of getting variables from mysql


Posted on 16th Feb 2014 07:03 pm by admin

Hi Guys,

I'm trying to streamline my CMS's code and as I was writing a new page it occured to me that there might be an easier way to get variables from a mysql query and that if anyone knew how to do it, it would be you guys.

Here is the code I use now:

Code: // Pulls the data from the database
$dblookup = "SELECT moduleID, menu_name, stylesheet_name, display_name, has_menu, access_control, installed, compatible, active FROM core_modules WHERE moduleID=" . $_GET['ID'];
$data = mysql_query($dblookup) or die('Failed to return data: ' . mysql_error());
/* sorts the data into variables and puts them in an array ready to be called when needed */
list($moduleID, $menu_name, $stylesheet_name, $display_name, $has_menu, $access_control, $installed, $compatible, $active) = mysql_fetch_array($data, MYSQL_NUM);
}
Is there a way I can just do SELECT * FROM and then have it automatically extract the data into variables based on the column name?

No comments posted yet

Your Answer:

Login to answer
203 Like 16 Dislike
Previous forums Next forums
Other forums

How to refresh a parent page from a modal popup
Hi,I have a modal popup in which I need to upload a file and store in the database should give a mes

passing an array of objects after submit
How do I do this? This is what I have tried and it is not working.

<form method="

Change of partner analyse in sales orders
Hello,

I changed the partner analyse for sales orders and added a new mandatory partnerro

max function question
Hi All
Ihave a table that holds shipment numbers and dates like this

select * from

ereg_replace in Wordpress
Heya - so I'm working on this site: http://world-of-smiles.theportlandco.com/new-patients

The

Undefined offset
The following script checks to see if the user answer matches the correct answer.

Form Fiel

Multiple websites question.
Hi, does php have any functionality that enables a programmer to extract information from a website

PHP Code reffering to database, doing something wrong.. pls help
Well i am quite new with PHP
and for school we have to make a PHP script which reffers to a Data

EU VAT Package 2010
Does any one know whether SAP will be developing new reporting functionality due the new VAT rules t

Concatenate two strings ???
I have string one $string1 and another $string2.

How to concatenate (add) both of them $str

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash