I'm new to PHP. Iv created a small php script. Basically I have a form and inside of it I have a function called show_sent:
<form method="post" action="contact.php" class="formstyle">
<h2>Formulaire de contact : </h2>
<p> </p>
<?
function show_sent(){
?>
<p>Sent</p>
<?
} // ...
I've created a dynamic table that will pull information from a database. However, there is 1 field that may have NOTHING in it, or it may have a bunch of information (from multiple check boxes) in it. I am trying to condense the initial table view (the details will show full db field information). What I have right now is this:
if...
this pattern will get me all files that begin with a nr and it works perfectly.
glob("path_to_dir/^[0-9]*");
but i want to have a pattern that gets me all files that ends with _thumbnail regardless file extension.
eg.
1.jpg
1_thumbnail.jpg
2.jpg
2_thumbnail.png
will get me
1_thumbnail.jpg
2_thumbnail.png
i have tried:
glob("pa...
ive got files named
1234_crob.jpg
1234.jpg
2323_örja.bmp
2323.bmp
etc
how can i just retrieve numbers eg. 1234 and 2323?
thanks in advance
...
This is my function to get stuff from a SQL db...
Is there a more elegant way to do this?
function getResults_1($id)
{
$this->db->select(array("a_1","a_2"))->from('Survey');
$this->db->where('user_id', $id);
return $this->db->get();
}
function getResults_2($id)
{
$this->db->select(array("a_6","a_8","a_13","a_14"))->fro...
I need to only allow members to write a review on a accommodation if they have stayed at the accommodation and there member_id matches the Auth->user('id').
On the accommodation/view I pass the BookingRequests data.
which looks like this
BookingRequest
0
member_id => 4
accepted => 1
1
member_id => 5
accepted => 0
...
I need a really good library or a command-line software that can be used to extract Exif data from images. No specific programming language, except the library or the software has to work really well.
I found various libraries for PHP and Python, but most of it hasn't been updated or being maintained and don't work for various manufact...
I am trying to make a function I can pass an mysql query into and get the result back or an error, it should also check to see if the user running the code is an admin, if they are then it will get a session variable that holds a number count of the mysql queries ran on the page and then increment it by 1 number and then set it back to a...
I have a php script which generates an image, and is used (mainly) like this:
<img src="user_image.php?id=[some_guid]" />
The script uses a class I wrote to display an image matching that ID. There are a number of things that could go wrong though, and each of them throws an exception. So I have something like this:
<?php
try {
...
I have pascal code (programming language actually doesn't mean anything):
box[1] := 14; box[2] := 2;
box[3] := 4; box[4] := 5;
box[5] := 6; box[6] := 8;
I want to get all possibilities. For instance, box[1] = box[6], then box[6] = box[1]. Yes, I can write it by my hand, but I guess I can make it more clever, by loop. Any ...
Would somebody care to help me out with a preg_match_all Regex?
I need to extract from a block that looks like this:
(arbitrary data)
alt=BAUSTEIN^550^^transparent^transparent^null^null^(...base64 encoded data...) ^
(arbitrary data)
alt=BAUSTEIN^550^^transparent^transparent^null^null^(...base64 encoded data...) ^
all base64 encoded b...
Hi,
I tried easyphp but i think it's not enough, I want an Apache / PHP / MySQL installer which has the latest PHP and MySQL version, and with curl and htaccess support.
Opensource solutions are preferred, should be windows vista compatible.
...
I am working on some PHP classes, I have a session class used to set and get values to session variables, I will need to have access to this session class object in every other class so I made a singleton method in the session class and then in other class's methods I can call the session object like this....
$session = Session::getInst...
I have a side menu that I want to to have the Admin option ONLY display IF the username is an admin. Simply if they are an admin, it's there, if they are not it shows another link to their profile.
Again, KISS (Keep It Super Simple)...please I am an noob.
Thanks
...
I want to redirect all www.domain.com requests to domain.com with PHP, basically:
if (substr($_SERVER['SERVER_NAME'], 0, 4) === 'www.')
{
header('Location: http://' . substr($_SERVER['SERVER_NAME'], 4)); exit();
}
However I do want to maintain the requested URL like in SO, for e.g.:
http://www.stackoverflow.com/questions/tagged/p...
I am getting this error in a PHP class...
Fatal error: Can't use method return
value in write context in
C:\webserver\htdocs\friendproject2\includes\classes\User.class.php
on line 35
Here is the troubled part.
if(isset($this->session->get('user_id')) && $this->session->get('user_id') != ''){
//run code
}
This code is...
I have some php code in a database like so
$x = "<?php some code here ?>";
but I want to output that whole line to the browser without php evaluating it. Right now it is evaluating it unfortunately. I thought about escaping it but that didn't work. How might a person accomplish this?
Thanks
EDIT:
<?php
echo '<? hey ?>';
echo "<do...
Can't figure this out for the life of me. Trying to return the column names from the clients securities table, then return the result as an array. Can anybody point out where I'm getting off track?
mysql_select_db("HandlerProject", $con); //Selects database
$selectcols = "SELECT * FROM ".$clientname."securitiestable"; //sel...
Hi,
The output of the following code on a random page is :
print $_SESSION['uid']; // logged in user
// Get Data .
$uid = $_GET['ID']; // part of random page processing
print $_SESSION['uid'];
is :
1
2
My logged in User ID is changing ! :@
The code for the login (authenticate) page is some...
Does anyone know why this happens?
var_dump(json_decode(stripslashes(json_encode(array("O'Reiley"))))); // array(1) { [0]=> string(8) "O'Reiley" }
var_dump(json_decode(stripslashes(json_encode(array("O\'Reiley"))))); // NULL
Are ' used at all by the JSON functions?
...