Tag Archives: MySql

Using Stored Procedures in Msyql with PHP

This will take an input and output a single value. Must define input and output data types. $db = mysqli_connect(“″, “dash_rw”, “password”, “database”); $db->query(“DROP PROCEDURE IF EXISTS p”); // take input and output single value. Output does not have to match table field length. $db->query(“CREATE PROCEDURE p(IN id_val INT, OUT pname varchar(100)) BEGIN SELECT name […]

Joomla: Executing Sql Queries with JDatabase

1) Getting the default database connection: $db =& JFactory::getDBO(); 2) Set the query. Can pass in start and length LIMIT values to shrink the resultset. This will add LIMIT 0,3 to the end. $db->setQuery($query,0,3); 3) Execute the query. You can call various methods depending on what amount of data is being returned $db->loadObject() – returns […]