Hi, I am building a site which will require some very limited content management for a client. There are only a few areas of the site which will require the client to be able to update the content themselves.
Would it be better to create a very simple custom admin page for the client to log in and say add a news story etc or would it be best using a fully fledged CMS like Drupal etc which seems overkill to me.
is_array($src2->crit) is generating an "Undefined property: stdClass::$crit" error.
The line throwing the error is:
if(is_array($src2->crit) && count($src->crit) > 0){
$src2->crit is initialized here.
$src2->crit = array();
$src2->crit[0] = new dataSet();
$src2->crit[0]->tblName = $tbl2;
$src2->crit[0]->colName = "ID";
$src2->crit[0]->val = $elm->editID;
When testing $src2->crit with this code.
print("\$src->crit is a ".$src->crit."<br />");
print_r($src->crit); print("<br />");
This is returned.
$src2->crit is a Array
Array ( [0] => dataSet Object ( [tblName] => sExam [colName] => ID [val] => 10 ) )
What am I not seeing/understanding correctly? If print("\$src2->crit is a ".$src->crit."<br />") returns that it is an array then why is is_array($src2->$crit) generating an error?
Hi,
I am trying to implement GZIP compression for my website. I copied the below code in my .htaccess file:
ExpiresActive On
ExpiresDefault A604800
Header append Cache-Control "public"
<IfModule mod_deflate.c>
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
what happens is when I type username and password the page reloads but still the login form is displayed but session is set. When I refresh the page using ctrl + R the login form goes and the username is displayed. what will be the problem. wwaiting for ur reply.
Hi Everyone! I have a form where I've got three checkboxes like this:
<td>Wireless <input type="checkbox" name="services[]" value="wireless" /></td>
</tr>
<tr>
<td>Cellular <input type="checkbox" name="services[]" value="cellular" /></td>
</tr>
<tr>
<td>Security <input type="checkbox" name="services[]" value="Security" /></td>
<input type="submit" name="submit">
and then I extract($_POST), and have this code
$comServices = implode(",", $services);
but I get an error:
Warning: implode() [function.implode]: Invalid arguments passed in ..
does anyone know why Im getting this error?
I need to get previous 30 days from a specific date which is available from database(eg: 2010-05-23 12:36:29).I am try it by using
date('d', strtotime("-30 days"))
Which is getting the currect answer what i looking for but it is not help me to enter date from database.Please help me to solve the issue.
PDO apparently has no means to count the number of rows returned from a select query (mysqli has the num_rows variable).
Is there a way to do this, short of using count($results->fetchAll()) ?
found this regex:
insert " " every 10 characters:
$text = preg_replace("|(.{10})|u", "\${1}"." ", $text);
can you, please, explain what \${1} means. Why using \ and what curly brackets means?
What is the correct (recommended method) for passing information to a view in a MVC environment.
Currently we use Zend Framework, where we write classes to handle specific things EG
a Book class with a save and load method to retrieve info from the DB, which is called from a particular nameAction().
What I would like to know is what is the best way to pass this information to the view, in some cases we do
$this-view-book_name = $book-getBookName();
and in other cases we do the following
$this-view-book = $book;
OR
$this-view-books = Book_Manager::getAllBooks();
and then access the object(s) properties in the view.
Information on-line suggests we try limit what access a view has to information, i.e pass them only what they need and in some cases people say its ok to pass stuff through as long as nothing is done to that information.
Regards
I have a form.The user enter the data ,the data will be stored in the data base.
Now,using phpmysql,i need to display the whole data present in db to front end.The user will click a particular thing and make some modifications and if,he press update the data should get into database.
Give me a snippet
http://dpaste.com/hold/178740/
Hey guys,
i need a method to capitalize every first letter of a word.
This is what i got so far and it is working for almost every string...but it fails on this one "WELLNESS & RENOMME".
// method in stringModify Class
function capitalizeWords($words, $charList) {
$capitalizeNext = true;
for ($i = 0, $max = strlen($words); $i < $max; $i++) {
if (strpos($charList, $words[$i]) !== false) {
$`capitalizeNext` = true;
} else if ($capitalizeNext) {
$capitalizeNext = false;
$words[$i] = strtoupper($words[$i]);
}
}
return $words;
}
// Calling method
$stringModify->capitalizeWords("WELLNESS & RENOMME", " -&");
I hope someone can help me out...i tried for 1,5 hours now and don't have a clue. Thanks in advance for any tips or hints.
Greetz
Paulie
hi, i have wrote a script to produce an array of data but now want to display in order of score. The array outputs as follows;
[display_name] => Array
(
[0] => ACT_Web_Designs
[1] => user1_design
[2] => user2_design
)
[proffesion] => Array
(
[0] => Web Developer
[1] => web developer
[2] => Web Developer
)
[score] => Array
(
[0] => 15
[1] => 6
[2] => 15
)
[img] => Array
(
[0] => ./?0000=gif&0001=3fadb8c362ff39f3322909899ff14760&0002=prof_pic
[1] =>
[2] =>
)
so in a nutshell I am wanting it to be converted as follows;
[display_name] => Array
(
[0] => ACT_Web_Designs
[1] => user2_design
[2] => user1_design
)
[proffesion] => Array
(
[0] => Web Developer
[1] => web developer
[2] => Web Developer
)
[score] => Array
(
[0] => 15
[1] => 15
[2] => 6
)
[img] => Array
(
[0] => ./?0000=gif&0001=3fadb8c362ff39f3322909899ff14760&0002=prof_pic
[1] =>
[2] =>
)
I have been looking at asort() but cant get anything to work. any help would be much appreciated.
When I run this code:
foreach($xml->movie as $movie) { if(isset($movie->photos)) { foreach ($movie->photos as $photo) { echo $photo." "; } echo "<hr/>"; } }
I get nice output of the actual data, e.g. a row looks like
06397001.jpg 06397002.jpg 06397003.jpg 06397004.jpg 06397005.jpg
But when I throw it in an array, it includes all the SimpleXML wrapper tags and the jpgs are not at the root of the array.
code:
foreach($xml->movie as $movie) { if(isset($movie->photos)) { $photos = array(); foreach ($movie->photos as $photo) { $photos[] = $photo; } } else $photos = ""; var_dump($photos); echo "<hr />"; }
e.g. same row looks like
array(5) { [0]= object(SimpleXMLElement)#11 (1) { [0]= string(12) "06397001.jpg" } [1]= object(SimpleXMLElement)#12 (1) { [0]= string(12) "06397002.jpg" } [2]= object(SimpleXMLElement)#13 (1) { [0]= string(12) "06397003.jpg" } [3]= object(SimpleXMLElement)#14 (1) { [0]= string(12) "06397004.jpg" } [4]= object(SimpleXMLElement)#15 (1) { [0]= string(12) "06397005.jpg" } }
Why is this happening/how can I remove this so I just get an array of the photos at root level like when I echo it?
Thanks, sorry for the single line code formatting; was messing up when I tried to paste directly with line breaks.
So specifically in a mysql database. Take the following code and tell me what to do.
// connect to the mysql database
$unsafe_variable = $_POST["user-input"];
mysql_query("INSERT INTO table (column) VALUES ('" . $unsafe_variable . "')");
// disconnect from the mysql database
$query = $connect->prepare("SELECT firstname, lastname FROM users WHERE id = '$id'");
$query->execute();
$row = $query->fetch();
// $full_name = $row["firstname"] . " ".$row["lastname"];
$full_name = $row["firstname"] . " ".substr($row["lastname"], 0, 1).".";
return $full_name;
If i remove the line that is a comment ( // ), it will return $full_name, if its there then it wont work. I also tried commenting with #, but it still wont work(wont return anything) as soon as there is a codecomment
weird issue
I have a list of words that I'd like to add a link to, I can do this fairly easily using preg_match_all and preg_replace:
$str = "<span class=\"cz\">Dám si jedno pivo prosím.</span> = I'll have a beer please.";
preg_match_all('/[a-ztúuýžácdéeínórš]+/i',$str,$matches);
$matches = array_unique($matches[0]);
foreach ($matches as $match) {
if(!empty($words[$match])) {
$str = preg_replace("/(^|[^\w]){1}(".preg_quote($match,"/").")($|[^\w]){1}/i", '\\1<a href="#">\\2</a>\\3', $str);
}
}
echo $str;
What I'd like to do is restrict the linking to only within the span tag.
My brain is all regex-ed out, so any help would be appreciated! Thanks!
Darren.
If I select a db db1 with mysql_select_db() is it possible to access another db db2 in a query? I am looking for something like SELECT * FROMdb2.sometableWHERE 1
When i upload a excel file, i have used COM() to open and automate converting it to xml.
It works fine, But when i run it, it always shows the message from Microsoft Excel:
A file named ''' already exists in this location. Do you want to replace it?
I can choose between Yes No and Cancel.
normally i would choose Yes. But i dont want users to click on Yes each time.
Can i disable this?
Please inform me if any relevant codes need to be posted.
Thanks
Hi all
I want to create an upload form to upload large files. Thats pretty much easy, however, the upload process itself taks long and basically looks like nothing is happening for a few minutes. So now I'd like to insert a progress bar to show the user that something is happening and they should just sit tight. I've read of numerous methods like APC and certian flash plugins, but my site is hosted on a shared server and I cant install any new applications on it.
I'm thinking, maybe if it is possible to read the size of the temp file it creates via an ajax page. By polling the size every few seconds I should be able to get the progress of the upload. Now the question I pose is...where is the temp file situated?
I want to convert this [email protected] to
hello@domain.com
I have tried:
url_encode($string)
this provides the same string I entered, returned with the @ symbol converted to %40
also tried:
htmlentities($string)
this provides the same string right back.
I am using a UTF8 charset. not sure if this makes a difference....
Sample code:
$html = file_get_contents('http://www.google.com');
echo $html;
It works on localhost. But after uploading to the webserver, it gives me a warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution. If I replace the domain name with google's IP address, it gives a warning: failed to open stream: Connection timed out.
And ini_get("allow_url_fopen") return 1.
Hay All,
I cant seem to get my head around this dispite the number to examples i read. Basically I have a 2d array and want to insert it into MySQL. The array contains a few strings.
I cant get the following to work...
$value = addslashes(serialize($temp3));//temp3 is my 2d array, do i need to use keys? (i am not at the moment)
$query = "INSERT INTO table sip (id,keyword,data,flags) VALUES(\"$value\")";
mysql_query($query) or die("Failed Query");
Thanks Guys,
Hello,
I have array
$list = array('string1', 'string2', 'string3');
Now i want to get the index of the value string2 i.e 1 and 2 for string3
All i want is the position of the strings in the array
string1 in 0
string2 in 1
string3 in 2
positions
How to get this ? i used array_search but it is no use !
please help !
I need to let my users type anything at the end of my url, like this:
http://mysite.com/?somethingorother
or
http://mysite.com/somethingorother
And then I would like to get that last bit that they added to the end of the url like so:
$var = $_POST[''];
But I'm not sure how to go about this, and I can't find anything, because I'm not quite sure how to search for it.
Any help is appreciated, thanks!
I have the following code and it should return just one value (id) from mysql table. The following code doesnt work. How can I output it without creating arrays and all this stuff, just a simple output of one value.
$query = "SELECT id FROM users_entity WHERE username = 'Admin' ";
$result = map_query($query);
echo $result;