Try it with echo $_REQUEST["email"];
Szabi Zsoldos 26 Learner and helper guy
kjeu_kach commented: I want to make code as the image +0
Try it with echo $_REQUEST["email"];
Actually your code is allright.
You should try the print_r($_GET) as diafol said
echo '<pre>'.print_r($_GET).'</pre>';
You have to concatenate the strings to work :)
$del_image = mysql_query("DELETE FROM image WHERE image_id = '".$image_id_g."' AND user_id='".$user_id_s."'");
$i = 0;
while($row = mysql_fetch_array($sql))
{
echo '<tr '.(($i <= 6)?'class="yourClass"':'class="yourOtherClass"').'><td>yourText</td></tr>';
$i++;
}
or
$i = 0;
while($row = mysql_fetch_array($sql))
{
echo '<tr '.(($i <= 6)?'style="border: 1px solid green"':'style="border: 1px solid black"').'><td>yourText</td></tr>';
$i++;
}
you have to deal with php or with javascript or with php when parsing your data, in either way you have to use preg_match() to get the desired syntaxes.
store the dates in a separate table with unixtimestamp and avoid big juicy joines in that table, in every query that u use, use specific WHERES and LIMITS so it can generate faster.
Another aproach for this stuff would be SAP HANA :)
Got it working, thanks :)
$total =$subtotal;
U should add the first value from the while()
change
$total = $subtotal;
to
$total += $subtotal;
Guys, I'm having a problem with the Magento Platform.
Trying to build an auto-populated option with Ajax, it works flawless in a simple folder outside Magento.
But with Magento, it's not populating from data.php
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("select[name='marca']").change(function(){
var optionValue = jQuery("select[name='marca']").val();
jQuery.ajax({
type: "POST",
url: "data.php",
data: ({marca: optionValue, status: 1}),
beforeSend: function(){ jQuery("#ajaxLoader").show(); },
complete: function(){ jQuery("#ajaxLoader").hide(); },
success: function(response){
jQuery("#modelAjax").html(response);
jQuery("#modelAjax").show();
}
});
});
});
</script>
If I include the source code from data.php it works but when the hiddent ID of #modelAjax is called to .show(); It loads the same page again with .html(response), page in page;
Is there another solution that i get just the requested data without .html() ?
there is a php function called reflection class as shown here, but never tried it.
Tried this class, it works but still the __construct is passing trough :)
As pritaeas said, the simplest workaround is to build a separate static class :)
That was my solution as well, created a static class after all.
Tought that I can skip the __construct :)
Beware of the simple mail() function.
You should set up a nice SMTP send function. Sometimes LINUX servers dont send out emails to other servers to the domain that they are in.
Hi guys,
I've made a class with a lot of functions, and for the 99% of the time i need the __construct functi.
How can i call the class without the __construct ?
class Test
{
public function __construct()
{
echo "bla";
}
}
$test = new Test();
What I want is when I call the new $test->blabla($test); the construct should not be invoked.
use at the top of your page ob_start()
and at the bottom ob_flush()
Hi guys,
Trying to implement a return module in magento but got a strange problem.
I'm passing values from a while loop into another page with values.
Everithing is working well but my first elements of a produs
and sku
are empty and I dont know why ....
The line with the data is
$retur_pas_final .= '<tr><td><input type="text" name="produs[]" value="'.$nume_produs[1].'" readonly="readonly" ></td><td><input type="text" name="sku[]" value="'.$key.'" readonly="readonly"></td><td>'.$motiv.'</td><td><input type="text" name="observatii[]" /></td></tr>';
[ok] => 37
[motiv] => Array
(
[0] => 0
[1] => 1
[2] => 2
)
[observatii] => Array
(
[0] =>
[1] =>
[2] =>
)
[produs] => Array
(
[0] => CEPSA XTAR MEGA TECH 5W30 DPF 1 L
[1] => CEPSA MOTO 2T 100 SINTETICO 1 L
)
[sku] => Array
(
[0] => 5119341
[1] => 5162241
)`
Why do you use the strtotime()
and not date()
?
the simplest way is to use fwrite()
and give the data with a while()
and save the filename with *.xls.
Pay attention to the end of each line to break it wit \t\n
, this will separate the lines by tab. Or you can separate each field with \t
and save it to *.xls.
Give us an example from your Database to help you with your query.
Instead try to use file_get_contents()
The name should be an array, cat[]
and class[]
and the verification should go via Javascript or you can pass your values via PHP but that is kind of old school.
Remember that before header()
there should be no echo.
If there is you can use a tweak at the top of your page just put ob_start();
and at the end of the page ob_flush()
;
The problem is in your while.
//IMAGEM $sel_img="SELECT * FROM produtos_img WHERE id_produto = '".$linha['id_produto']."'"; $img=mysql_query($sel_img, $futura); echo '<tr><td align="left"><img src="'.$img['imagem'].'"/></td></tr>';
You have to fetch your $sel_img
query.
`$sel_img=mysql_query("SELECT * FROM produtos_img WHERE id_produto = '".$linha['id_produto']."'");
`if(mysql_num_rows($sel_img) > 0)
{
$img = mysql_fetch_array($sel_img);
echo '<tr><td align="left"><img src="'.$img['imagem'].'"/></td></tr>';
}
else
{
echo 'No images found.';
}`
header('Location: yourpage.extension')
or you could use the window.location
from Javascript.
You have to have a unique identifier on the row from the Database.
Then you have to get the data from the DB on click into a form to edit it.
Then all you have to to is to update the DB with your new values, if there are new values.
well you have to pass your form value into a variable to pass it to a session $username = $_GET['username']
and then use the $_SESSION['username'] = $username;
or $_GET['username'] = $_SESSION['username'];
Paste your code regarding the username and password.
Where do you assign the password and username to your session ?
As Philippe said, you have to pass a value to your <a href=''>
echo '<p>' .$r['id'].' <b><a href="yourPage?venue='.$r['yourId'].'">'.$r['venue'].'</a></b> '.$r['address'].' </br>'.$r['city'].'</p>' ;
Then you have to get the value from yourPage?venue=yourID
$venueId = $_GET['yourId']
`SELECT * FROM table WHERE field = mysql_real_escape_string($venueId);`
After this, you just have to read the data from the Database.
Ove way to do this would be.
You should set a session_start(); at the beginning of your script.
If mysql_num_rows() returns > 0 then set a $_SESSION, then if your Session isset() then you can load the desired header.
Did you ran that query in your db ? If so, what does it return ?
In that case you should use HTML5 for that functionality
Could you post part of your code so we can help you ?
In that case, you should escape it mysql_real_escape_string($_GET['something'])
I don't actually understand your question. What do you need it for ?
Or simply you can use the CONCAT() function
Got it working, I've put AND p.tip in('A','C') into the subselect and it worked instantly :)
Hello,
I've built a timekeeping aplication from a fingerprint machine with automatic import to db and I'm getting some reports.
One report is that I'm getting the employees time if they are late from work.
But my table is small with 20.000 entries, but with the following query, the results are generating in 9.7 seconds, and its really slow.
I have to use INNER JOIN and some subselects for getting the minimal hour and other stuff.
Could I optimize this query more ?
`SELECT p.data,u.name, SEC_TO_TIME(AVG(TIME_TO_SEC(p.ora))) as timp, u.user, p.tip, u.program_de_la FROM utilitar.pontaj as p
INNER JOIN utilitar.pontaj_usr as u ON u.user = p.user
WHERE p.user NOT IN('000127','000126')
AND p.data = '2012-05-08' AND (SELECT MIN(ora) FROM utilitar.pontaj WHERE data = '2012-05-08' AND user = p.user) > u.program_de_la AND p.tip in('A','C')
AND u.program_de_la NOT IN('','-')
AND u.program_pana_la NOT IN('','-' )
GROUP BY p.user ORDER BY timp ASC, u.name ASC`
Results
"data" "name" "timp" "user" "tip" "program_de_la"
"2012-05-08" "xxxxxxxxxxxxxxxxxxxx " "07:08:00" "000030" "A" "07:00"
"2012-05-08" "34tgyhhgddfgdgdf" "08:32:00" "000001" "A" "08:30"
"2012-05-08" "34tgyhhgddfgd" "08:33:00" "000132" "A" "08:30"
"2012-05-08" "34tgyhhgddfgdgdf" "08:34:00" "000187" "A" "08:30"
"2012-05-08" "34tgyhhgddfgdgdf" "08:38:00" "000039" "A" "08:30"
"2012-05-08" "34tgyhhgddfgdgdf" "09:14:00" "000046" "A" "08:30"
"2012-05-08" "34tgyhhgddfgd" "14:23:00" "000101" "A" "14:00"
The results are correct but a little slow.
solved.
$tabelIntrari = '<table>';
$tabelIntrari .= '<tr><th>Tip</th><th>Nume</th><th>Ora</th></tr>';
$a=0;
$b=0;
while($row = mysql_fetch_array($raport_zi))
{
if($row['tip']=='A' && $a==0)
{
$tabelIntrari .= '<tr><th colspan="3" align="center">Iesire</th></tr>';
$a=1;
}
if($row['tip']=='B' && $b==0)
{
$tabelIntrari .= '<tr><th colspan="3" align="center">Iesire</th></tr>';
$b=1;
}
$tabelIntrari .= '<tr><td>'.$row['tip'].'</td><td>'.$row['name'].'</td><td>'.$row['timp'].'</td></tr>';
}
$tabelIntrari .= '</table>';
Hi guys,
Working on a table.
Each of the entries has an A or B in the 'tip' field.
I order them by 'tip'
how can i add a special row for the first entry of the A or B series from the query?
I know it's not an IF
Example:
ENTRY TIME
A 231 name1 3:23
A 123 name2 4:23
A 123 name3 5:23
A 123 name4 6:23
A 123 name5 7:23
A 123 name6 8:23
A 123 name7 9:23
EXIT TIME
B 124 name8 10:23
B 125 name9 11:23
B 126 name10 12:23
B 127 name11 13:23
B 128 name12 14:23
B 129 name13 15:23
B 130 name14 16:23
B 131 name15 17:23
$raport_zi = mysql_query("SELECT u.name, SEC_TO_TIME(AVG(TIME_TO_SEC(p.ora))) as timp, u.user, p.tip FROM utilitar.pontaj as p
INNER JOIN utilitar.pontaj_usr as u ON u.user = p.user
WHERE p.tip = 'A'
AND p.data >= '2012-02-01'
GROUP BY p.user
ORDER BY u.name ASC");
$output = '<table>';
$output .= '<tr><th>Nume</th><th>Ora</th></tr>';
while($row = mysql_fetch_array($raport_zi))
{
$output .= '<tr><td>'.$row['name'].'</td><td>'.$row['timp'].'</td></tr>';
}
$output .= '</table>';
First of all you should do a JavaScript with return false; for not letting the script to go further.
You should do a verification by PHP as well
Well this is a class, you should see what functions it has.
That was it :) Thanks!
Hey guys,
I'm working on a ajax drop down system.
I'm currently finding myself in a difficulty with a $_POST[].
The thing is that I want to explode my $_POST but it doesn't let me for something, cant find it out why.
case 2:
if(strstr($_POST['modelBox'],'^'))
{
$ex = $_POST['modelBox'];
$explodeBox = explode('^',$ex);
if($explodeBox[1] == '')
{
$modelBox = ' WHERE model = "'.$explodeBox[0].'"';
}
else
{
$modelBox = ' WHERE model = "'.$explodeBox[0].'" AND production_year = "'.$explodeBox[1].'"';
}
$sql = 'SELECT DISTINCT(wheel_dimension),material FROM catalogue.wheel_code '.$modelBox.' ORDER BY wheel_dimension ASC;';
$depts = mysql_query($sql);
while (list($wheel_dimension,$material) = mysql_fetch_array($depts))
echo $wheel_dimension."=".$wheel_dimension."*";
break;
This is the $_POST ->
model = 'Golf IV Variant^01.99-04.07'
Here is the result that you need.
for(i = 1; i <= 5; i++)
{
for(j = 1; j <= 5; j++)
{
System.out.println(j);
if(j == 5)
{
System.out.println("Loop terminated at " + i);
}
}
}
1
2
3
4
5
Loop terminated at 1
1
2
3
4
5
Loop terminated at 2
1
2
3
4
5
Loop terminated at 3
1
2
3
4
5
Loop terminated at 4
1
2
3
4
5
Loop terminated at 5
That was my problem :) thank you!!
Steve,
I have no REQUEST on this page, at all, but my file POST is not submitting with method="POST" only with method="GET"
<?php
if(isset($_GET['mesaj']) && $_GET['mesaj'] == 'nou')
{
?>
<form enctype="multipart/form-data" action="mesaje_furnizori.php" method="POST">
<table>
<tr><td align="right">Va rugam selectati » </td><td><?php echo $selectare_furnizor; ?></td></tr>
<tr><td align="right"><td><input type="file" name="file" id="file"/></td></tr>
<tr><td align="right" colspan="2">Fisiere suportate (.*gif,*.jpg,.*jpeg,.*png,.*bmp,.*doc,.*docx,.*xls,.*xlsx) Marimea maxima de: <strong>5MB</strong></td></tr>
<tr><td colspan="2"><textarea name="mesajTrimis" cols="70" rows="15"></textarea></td></tr>
</table>
<input type="hidden" name="trimis" value="ok" />
<input type="submit" value="Trimite"/>
</form>
<?php
}
if(isset($_POST['furnizor_selectat']) || isset($_POST['file']) || isset($_POST['mesajTrimis']) || isset($_POST['trimite']) && $_POST['trimite'] == 'ok')
{
$hash = md5(date("H:i:s Y.m.d"));
echo $_POST['file'];
exit;
And the output is ->
Notice: Undefined index: file in /web/sites/blabla.com/mesaje_furnizori.php on line 154
Hey Steve, I know :)
Tha problem is that with GET is working but with POST and REQUEST is not.
mesaje_furnizori.php?furnizor=53443&file=mesaje.png&mesajTrimis=adsdasd&trimis=ok
This is the weird part ...
Hello,
I have this weird issue with my simple upload form for different files.
<form enctype="multipart/form-data" action="mesaje_furnizori.php" method="GET">
<table>
<tr><td align="right">Va rugam selectati » </td><td><?php echo $selectare; ?></td></tr>
<tr><td align="right"><td><input type="file" name="file" id="file"/></td></tr>
<tr><td align="right" colspan="2">Fisiere suportate (.*gif,*.jpg,.*jpeg,.*png,.*bmp,.*doc,.*docx,.*xls,.*xlsx) Marimea maxima de: <strong>5MB</strong></td></tr>
<tr><td colspan="2"><textarea name="mesajTrimis" cols="70" rows="15"></textarea></td></tr>
</table>
<input type="hidden" name="trimis" value="ok" />
<input type="submit" value="Trimite"/>
</form>
The file is passed into my TMP.
Array
(
[file] => Array
(
[name] => mesaje.png
[type] => image/png
[tmp_name] => /tmp/phpvdjnGr
[error] => 0
[size] => 4009
)
)
The weird part is when I print_r($_REQUEST); The file is not showing up ($_REQUEST) ... can't figure out why ... Please help with this one
Array
(
[furnizor_selectat] => 12555
[mesajTrimis] => test
[trimis] => ok
[PHPSESSID] => 5pkk0q1ou8dkk46etqmsldprh4
[__utma] => 48988665.324662620.1320745888.1321512004.1321522554.23
[__utmb] => 48988665.5.10.1321522554
[__utmc] => 48988665
[__utmz] => 48988665.1320745888.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
)
Notice: Undefined index: file in /web/sites/blabla.com/mesaje_furnizori.php on line 156
Actually what you need is a simple database with a table in it, or two, and fetch the data with some simple querys.
You could use just the simple mysql_num_rows, so if you get a record that equals your form input, then it redirects you to your desired page, else, it will display a message.
<?php
if(isset($_REQUEST['login']))
{
$query = "SELECT user, pass FROM yourTable WHERE user='".mysql_real_escape_string($_REQUEST['user'])."'";
$result = mysql_query($query);
if (mysql_num_rows($result)>0)
{
$client = mysql_result($result,0,"user");
$password = mysql_result($result,0,"pass");
if (isset($_REQUEST['user']) && $_REQUEST['user'] == $client && isset($_REQUEST['pass']) && $_REQUEST['pass'] == $password)
{
header('Location: index.php');
}
}
else
{
echo 'Wrong passwod';
}
}
?>
Simply you can do this with a simple if/elseif/else statement.
You just have to play with your variables and with your database fields.
<?php
if (isset($_REQUEST['yourColumnValue1']) && $_REQUEST['yourColumnValue1'])
{
$q = mysql_query("SELECT * FROM yourTable
WHERE yourField LIKE '%".mysql_real_escape_string($_REQUEST['SearchValue'])."%'
|| yourField2 = '".mysql_real_escape_string($_REQUEST['SearchValue'])."'
ORDER BY x, y");
}
elseif (isset($_REQUEST['yourColumnValue2']) && $_REQUEST['yourColumnValue2'])
{
$q = mysql_query("SELECT * FROM yourTable
WHERE yourField LIKE '%".mysql_real_escape_string($_REQUEST['SearchValue'])."%'
|| yourField2 = '".mysql_real_escape_string($_REQUEST['SearchValue'])."'
ORDER BY x, y");
}
?>