SQL Query

I need to get a particular column ‘value’ where it has alot of characters looks like a short paragraph, now i want a string Pretest_Score=25 i.e., it should display 25

in my table. How could be this done?. Please kindly help me with exact sql query.

SELECT TRIM(‘value’) FROM mdl_sample

PHP,MySQL

I inserted a single link to database with a single field ‘addlink’, likewise i inserted again & again and now totally i have
5 rows. How can i get all the rows from database and update them. Please help with this.

/*——————-Inserting working Successfully */
echo ‘<font size=”4px” face=”verdana”><b>Add a New Link</b></font><br><br>’;
if($_SERVER['REQUEST_METHOD']==’POST’)
{
$add1 = $_REQUEST["add"];
$sql=”INSERT INTO mdl_block_left_menu_front(addlink) values(‘$add1′)”;
$a=mysql_query($sql);
if(!$a)
{
error(‘There was an error while inserting the link’);
}
else
{
echo “Changes saved Successfully”;
}
}

echo ‘<form name=”fname” action=”add.php” method=”post”>’;
echo ‘Add a link : <input type=”field” name=”add”><br><br>’;
echo ‘<input type=”submit” value=”submit”></form>’;

/*————————— Need help in updating

echo ‘<td id=”middle-column” style=”text-align:center;”>’;
echo ‘<font size=”4px” face=”verdana”><b>Edit Link</b></font><br><br>’;
$list = get_records_sql(‘SELECT * FROM mdl_block_left_menu_front’);

/* Displaying the field values from database */
foreach($list as $listed)
{
$addlinky = $listed->addlink;
echo ‘<form name=”f” action=”update.php” method=”post”>’;
echo ‘<table width=150 cellspacing=4 cellpadding=4><tr align=center><td><input type=”text” value=”‘.$addlinky.’”</td></tr></table>’;
}
/* Displaying the field values from database */

echo ‘<input type=”submit” value=”submit”></form>’;

/* Editing the field values and submitting again to the database */

if($_SERVER['REQUEST_METHOD']==’POST’)
{
$sql=’UPDATE mdl_block_left_menu_front SET addlink=”‘.$addlinky.’”‘;
//echo ‘UPDATE mdl_block_left_menu_front SET addlink=’.$addlinkyy.”;
$a=mysql_query($sql);
if(!$a)
{
error(‘There was an error while inserting the link’);
}
else
{
echo “Changes saved Successfully”;
}
}
/* Editing the field values and submitting again to the database */
echo ‘</td>’;

PHP file convert to XML

<?
function parseToXML($htmlStr)
{
$xmlStr=str_replace('<','&lt;',$htmlStr);
$xmlStr=str_replace('>','&gt;',$xmlStr);
$xmlStr=str_replace('"','&quot;',$xmlStr);
$xmlStr=str_replace("'",'&apos;',$xmlStr);
$xmlStr=str_replace("&",'&amp;',$xmlStr);
return
$xmlStr;
}

// Start XML file, echo parent node
echo '<items>';

echo '<item ';
echo
'name="' . parseToXML(stripslashes($sName)) . '" ';
echo
'address="' . parseToXML(stripslashes($sAddress)) . '" ';
echo
'price="' . parseToXML($iPrice) . '" ';
echo
'link="' . parseToXML($sLink) . '" ';
echo
'details="' . parseToXML(stripslashes($tDetails)) . '" ';
echo
'other="' . parseToXML(stripslashes($sOther)) . '" ';
echo
'/>';

// End XML file
echo '</items>';

?>

Convert PHP Array to XML or Simple XML Object

class ArrayToXML

{

/**

* The main function for converting to an XML document.

* Pass in a multi dimensional array and this recrusively loops through and builds up an XML document.

*

* @param array $data

* @param string $rootNodeName – what you want the root node to be – defaultsto data.

* @param SimpleXMLElement $xml – should only be used recursively
* @return string XML

*/

public static function toXml($data, $rootNodeName = ‘data’, $xml=null)

{

// turn off compatibility mode as simple xml throws a wobbly if you don’t.

if (ini_get(‘zend.ze1_compatibility_mode’) == 1)

{

ini_set (‘zend.ze1_compatibility_mode’, 0);

}

if ($xml == null)

{

$xml = simplexml_load_string(“<?xml version=’1.0′ encoding=’utf-8′?><$rootNodeName />”);

}

// loop through the data passed in.

foreach($data as $key => $value)

{

// no numeric keys in our xml please!

if (is_numeric($key))

{

// make string key…

$key = “unknownNode_”. (string) $key;

}

// replace anything not alpha numeric

$key = preg_replace(‘/[^a-z]/i’, ”, $key);

// if there is another array found recrusively call this function

if (is_array($value))

{

$node = $xml->addChild($key);

// recrusive call.

ArrayToXML::toXml($value, $rootNodeName, $node);

}

else

{

// add single node.

$value = htmlentities($value);

$xml->addChild($key,$value);

}

}

// pass back as string. or simple xml object if you want!

return $xml->asXML();

}

}

PHP Object Based

I need a dynamic template file for the pictures that will be pulled from the database.

a.     I need a location for them to be stored and code that designates where to place the pictures that were uploaded or taken from facebook.

This is going to be object based PHP and  I want each module to be separated into a different PHP file. I need the code only pulling information and putting information into dynamic places.

Please help me

AutoTags

Basing on WordPress Plugin “tagthepress” .It using for tag suggestions by Yahoo cas API http://tw.developer.yahoo.com/cas/

With this plugin, you will be able to use the the Web service for your posts. Just click on Fetch tags and the title, content and optional excerpt of your post will be analyzed by Yahoo cas API in order to find words that could be useful as tags.

It currently works with English, Chinese

Fckeditor Configuration File

The editor comes with a rich set of configurations that makes it possible to customize its appearance, features and behavior. The main configuration file is named “fckconfig.js“. You can find this file in the root of the FCKeditor installation folder. Read more »

Event Registration Joomla

Following is the link to list of components for Event Registration in Joomla.

http://extensions.joomla.org/extensions/calendars-a-events/events-registration

Javascript Validation for uploading files

The below javascript funtion checks the browsing file. For example, If 

the uploading file should accept only excel and word documents like that, 

then in that scenario, we can use this function.
 Read more »

Joomla Podcast Suite

Podcast Suite.

A component, module, and mambot designed to bring podcasting capabilities to Joomla. Support for iTunes.