I am a little stuck on how to create this array.
My data:
category_id | category_name
1 bikes
2 cars
3 books
4 computers
Array:
$category=array();
$query = "SELECT * FROM categories ORDER BY name ASC";
$result = $db->query($query);
$category=array('category_id...
To be honest, I suck at regex so much, I would use RegexBuddy, but I'm working on my Mac and sometimes it doesn't help much (for me).
Well, for what I need to do is a function in php
function replaceTags($n)
{
$n = str_replace("[[", "<b>", $n);
$n = str_replace("]]", "</b>", $n);
}
Although this is a bad example in case someo...
I have a simpleXml object and want to read the data from the object , I am new to PHP and dont quite know how to do this. The object details are as follows.
I need to read [description] and [hours]. Thankyou.
SimpleXMLElement Object (
[@attributes] => Array (
[type] => array
)
[time-entry] => Array (
[0] =>...
Hi,
Does anyone know any good ordering and sorting behaviours for cakephp?
The sort where I can have "Move Up", "Move Down", "Move to top" and "Move to bottom"?
That sort of this.
Thanks!
...
Im building a codeigniter app which uses json_encode to provide ajax data in many places... today I learned that the server has php 5.1.6 which doesnt support this method (or json_decode).. what can I do?? please help.
...
Pretty new to all this, so if I am going about my puzzle in a crazy way please tell me!
I have a table in a mySQL database with the columns title, hyperlink, imagelink
I want the php to select a row at random, then be able to save the title, hyperlink and imagelink as php variables. (so I can then output them into html)
so I could hav...
Hey guys I have a connection class I found for pdo. I am calling the connection method on the page that the file is included on. The problem is that within functions the $conn variable is not defined even though I stated the method was public (bare with me I am very new to OOP), and I was wondering if anyone had an elegant solution othe...
I have a url, http://www.jdocy.com/click-42343-32422
I want to replace the 42343 section of the url with php's preg_replace function.
How would I go about doing this?
...
i'm trying to search for multiple columns using this code:
<?php
// Connection Database
$search = $_POST ['Search'];
mysql_connect("xxxxxx", "xxxxxx", "xxxxx") or die ("Error Connecting to Database");
mysql_select_db("xxxxx") or die('Error');
$data = mysql_query("SELECT CourseName, CourseDescription, CourseLeader FROM course ...
I'm trying to use PHP to create a file, but it isn't working. I am assuming this is because it doesn't have write access (it's always been the problem before). I tried to test if this was the problem by making the folder chmod 0777, but that just ended up making every script in that directory return a 500 error message until I changed it...
Hello,
I have :
$date = $actualite['date'];
$actualite['date'] is a TIMESTAMP
and i was wondering how i can extract from this timestamp the day, then the month, then the year in 3 variables.
Thank you for your help :
...
Is there any WordPress equivalent function for Drupal's url()?
...
I have two for each loops and I am trying to output something different for each second result:
foreach ($wppost as $wp) {
$wp_title = $wp->post_title;
$wp_date = strtotime($wp->post_date);
$wp_slug = $wp->post_name;
$wp_id = $wp->ID;
// Start Permalink Template
$wp...
Hi guys,
I'm setting up PHP Eclipse with Zend Server CE as a debugger.
I start debugging a file, and it opens either in the internal web browser or in Firefox.
However, when stepping through the file, after a minute or so the internal web browser stops waiting for a response and brings up a file download box. e.g. if I was debugging i...
<?php
// Connection Database
$search = $_POST ['Search'];
mysql_connect("xxxxxx", "xxxxxxxxx", "xxxxxx") or die ("Error Connecting to Database");
mysql_select_db("xxxxxx") or die('Error');
$data = mysql_query("SELECT* FROM course WHERE MATCH (CourseName, CourseDescription, CourseLeader) AGAINST ('". $search ."')")
...
I've got a string like this:
####################
Section One
####################
Data A
Data B
####################
Section Two
####################
Data C
Data D
etc.
I want to parse it into something like:
$arr(
'Section One' => array('Data A', 'Data B'),
'Section Two' => array('Data C', 'Data D')
)
At first I tri...
Let's say I have a php file, test.php with 2 functions: test1() and test2().
If I have an external php file, index.php, with include(test.php) in its code. If in the index.php file has a reference to test1() but not test2(), is there any way that someone would be able to execute test2() by doing something malicious while using the index...
Hello Everyone,
I am trying to build a dynamically generated unordered list in the following format using PHP. I am using CodeIgniter but it can just be normal php.
This is the end output I need to achieve.
<ul id="categories" class="menu">
<li rel="1">
Arts & Humanities
<ul>
<li rel="2">
Photography
...
Hello,
I made a comment on a Wordpress blog and I noticed that after I submitted the comment, the top of the browser was flush with the top of my comment. In other words, the web page was auto-scrolled down to the top of my comment.
How can I do this? I am using a comment system with PHP / MySQL.
Thanks in advance,
John
...
Whey does this evaluate to true?
<?php
$val2=0;
//outputs that is an error123
if($val2=='error123'){
echo 'that is an error123<br />';
}else{
echo 'that is not an error123<br />';
}
...