Its ok thanks i sorted it with ' . $txt1 . ' ' . $txt2 . '
Thanks for your help resolving the original problem
Its ok thanks i sorted it with ' . $txt1 . ' ' . $txt2 . '
Thanks for your help resolving the original problem
Sorry my fault i did something wrong from your info... thanks for that info
Also if i want to echo $txt1 $txt2 in that ($result)==0 echo what format would they have to be in please eg at the moment i have
echo '$txt1 $txt2...';
but the result just echos $txt1 $txt2... onto the page rather than what they should
still does not echo the result zero im afraid
Hi I have this working for the query to output the result but the if zero results echo is not working, and I cnat see why, if anyone can help please, there is no error that comes up and to test there is nothing in the database table, it works when there is something in and echos out the result but not when the result is 0
$result = mysql_query("whatever query") or trigger_error(mysql_error().$sql);
while($row = mysql_fetch_array($result)){
if(mysql_num_rows($result)==0)
{
echo 'there is none....';
}
else
echo 'my stuff that works';
}
Hi
I have changed to comma rather than tab and the query now works perfect, thanks for your help
wow thanks thats great, will try it now
I can change it to commas, so how would work with FIND_IN_SET() please
Hi I am trying get a query to join 2 tables and a result on the information in both. At the moment I have the following
$query = "SELECT * FROM TABLE1, TABLE2 Where 'TABLE2.field1' LIKE '%TABLE1.field2%'";
The problem is TABLE2 has a field with names in but TABLE1.field2 has |name|name|name| and so on. |=TAB
So im struggling for the query to find a match in there somewhere.
Can anybody suggest anything please
Thanks
Brilliant works perfect, thanks for your help
Hi
I am trying to get to download images into a file from database field urls onto my server as there is lots of them. I think im on the right track.
I currently have an error
Parse error: syntax error, unexpected T_STRING in getimages.php on line 11
Hope someone can help with this please.
<?php
mysql_connect("localhost", "X", "X") or die(mysql_error());
mysql_select_db("X") or die(mysql_error());
$query = "SELECT * FROM TABLE";
$result = mysql_query($query) or die(mysql_error());
while($file = mysql_fetch_array($result))
{
$image = file_get_contents(' . $file[' . image . ']. ');
$path = 'images/' . $file[' . image . '] . ';
file_put_contents($path, $image);
}
?>
OK thanks for your help will try that
Hi
Thanks for your reply but NO. The first code shows I just want to echo out that part but then echo out the same part several times for each different name in F
Hope the clears it up
Thanks
Hi No I am just planning so I get nothing, but I know that info is correct, but when I complete it without a foreach I will have to do several queries on a big database rather than 1 with a foreach.
For example
<?php
$con = mysql_connect("localhost","X","X");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("dbname", $con);
$result = mysql_query("SELECT `A`, `B`, `C`, `D`, `E`, `F`, `G`, `H` FROM TABLE WHERE `F` = 'billy' ORDER BY `H`+0 DESC LIMIT 10") or trigger_error(mysql_error().$sql);
echo "<table cellspacing='0' cellpadding='0' class='altrowstable' id='alternatecolor' width='100%'>
<tr>
<th>A</th>
<th>B</th>
<th>C</th>
<th>D</th>
<th>E</th>
<th>F</th>
<th>G</th>
</tr>";
$n = 1;
while($row = mysql_fetch_array($result))
{
echo"<div id='tab_'.sprintf("%.0f",$n++).'' class='show parent' style='background-position:99.8% center; background-size: auto 100%; border-radius:0 0 3px 0; -moz-border-radius:0 0 3px 0; -webkit-border-radius:0 0 3px 0; -o-border-radius:0 0 3px 0; display: block;'>
<div class='col-3'>
<div class='table_view'>
<div class='table_info_head'>
<div class='info_table_outer'>
<div class="table_info'>
echo "<tr>";
echo '<td>' . $row['A'] . ' with other info></td>';
echo '<td>' . $row['B'] . ' with other info></td>';
echo '<td>' . $row['C'] . ' with other info></td>';
echo '<td>' . $row['D'] . ' with other info></td>';
echo '<td>' . $row['E'] . ' with other info></td>';
echo '<td>' . $row['F'] . ' with other info></td>';
echo '<td>' . $row['G'] . ' with other info></td>';
echo "</tr>";
}
echo "</table>";
echo "</div>
</div>
</div>
</div>
</div>
</div>";
$result = mysql_query("SELECT `A`, `B`, `C`, `D`, `E`, `F`, `G`, `H` FROM TABLE WHERE `F` = 'simon' ORDER BY `H`+0 DESC LIMIT 10") or trigger_error(mysql_error().$sql);
echo "<table cellspacing='0' …
OK thanks, I have given made up examples rather than get details from the database.
A B C D E F G H
1 2 3 4 5 Billy 6 1
1 2 3 4 5 Bob 6 2
1 2 3 4 5 Billy 6 3
1 2 3 4 5 Bob 6 4
1 2 3 4 5 Sue 6 5
1 2 3 4 5 Sue 6 6
1 2 3 4 5 Simon 6 7
1 2 3 4 5 Billy 6 8
1 2 3 4 5 Sue 6 9
1 2 3 4 5 Bob 6 10
1 2 3 4 5 Simon 6 11
Hi Im trying to get mysql_query result with foreach set up and i am just planning what i am going to do but I am stuck with adding foreach into my code so far.
Basically F field has several different options which are duplicated lots of times, so i need the F field in the WHERE F
= to be foreach different option in that field. (HOpe I have explained OK)
If someone could help it would be great Thanks
<?php
$con = mysql_connect("localhost","X","X");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("dbname", $con);
$result = mysql_query("SELECT `A`, `B`, `C`, `D`, `E`, `F`, `G`, `H` FROM TABLE WHERE `F` = 'blar' ORDER BY `H`+0 DESC LIMIT 10") or trigger_error(mysql_error().$sql);
echo "<table cellspacing='0' cellpadding='0' class='altrowstable' id='alternatecolor' width='100%'>
<tr>
<th>A</th>
<th>B</th>
<th>C</th>
<th>D</th>
<th>E</th>
<th>F</th>
<th>G</th>
</tr>";
$n = 1;
while($row = mysql_fetch_array($result))
{
echo"<div id='tab_'.sprintf("%.0f",$n++).'' class='show parent' style='background-position:99.8% center; background-size: auto 100%; border-radius:0 0 3px 0; -moz-border-radius:0 0 3px 0; -webkit-border-radius:0 0 3px 0; -o-border-radius:0 0 3px 0; display: block;'>
<div class='col-3'>
<div class='table_view'>
<div class='table_info_head'>
<div class='info_table_outer'>
<div class="table_info'>
echo "<tr>";
echo '<td>' . $row['A'] . ' with other info></td>';
echo '<td>' . $row['B'] . ' with other info></td>';
echo '<td>' . $row['C'] . ' with other info></td>';
echo '<td>' . $row['D'] . ' with other info></td>';
echo '<td>' . $row['E'] . ' with other info></td>';
echo '<td>' . $row['F'] . ' with other info></td>';
echo '<td>' . $row['G'] . ' with other info></td>';
echo "</tr>";
}
echo …
Hi Sorry
My fault I did not read it correctly ,
Thanks you
Hi
Thanks for your reply, but I only have to do 2 clicks and everything is imported manually. I am looking for something that is automated
Hi
Hope someone can help with this as I dont really know where to start.
I am trying to automate a quite large txt feed I get from an external url to import into database. I currently do it manually through database software, but it takes too long each day.
Can anyone give me a pointer
Cheers
prefect thanks
its this line
title: "",
Hi
Hope someone can help with this.
I have javascript set up how i want it in a normal html page but now need to ensure i can call a result using php with it. My code throws out an error
The code states Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'
<body>
<?php
$con = mysql_connect("","","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("", $con);
$result = mysql_query("my query") or trigger_error(mysql_error().$sql);
while($row = mysql_fetch_array($result)){
echo '<div class="BoxContainer">
<div class="contentBox">
<span class="inBoxTitle green">A box</span>
<!-- Demo Button! -->
<button class="botGreen" id="botSmallPic1">Picture 1</button>
</div>
</div> <!-- .BoxContainer -->
<script src="/css/static/js/box.js"></script>
<script type="text/javascript">
// ======== Box
$("#botSmallPic1").click(function(){
$.smallBox(
{
title: "",
content: "",
color: "#ec008c",
img: "",
icon: ""
}
);
});
</script>';
}
?>
</body>
</html>
the error Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'
The error comes up around this part
$("#botSmallPic1").click(function(){
$.smallBox(
{
title: "",
content: "",
color: "#ec008c",
img: "",
icon: ""
}
);
});
yes im going to be putting the $row information in, im getting rid of this problem then i can go and add all that information
thanks for the reply but it says there is an error and I think there is around the
// ======== Box
$("#botSmallPic1").click(function(){
$.smallBox(
{
title: "",
content: "",
color: "#ec008c",
img: "",
icon: ""
}
);
});
due to the { } which are in the code as the php result code says in between { }. I have no idea how to get round it
Sorry here you go
<body>
<?php
$con = mysql_connect("","","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("", $con);
$result = mysql_query("my query") or trigger_error(mysql_error().$sql);
while($row = mysql_fetch_array($result)){
echo '<div class="BoxContainer">
<div class="contentBox">
<span class="inBoxTitle green">A box</span>
<!-- Demo Button! -->
<button class="botGreen" id="botSmallPic1">Picture 1</button>
</div>
</div> <!-- .BoxContainer -->
<script src="/css/static/js/box.js"></script>
<script type="text/javascript">
// ======== Box
$("#botSmallPic1").click(function(){
$.smallBox(
{
title: "",
content: "",
color: "#ec008c",
img: "",
icon: ""
}
);
});
</script>';
}
?>
</body>
</html>
Hi
Thanks for the reply
Yeah im adding the $row info later as there is a lot of it, that why im trying to get rid of these issues first
It looks like the problem is with this area
{
title: "",
content: "",
color: "#ec008c",
img: "",
icon: ""
}
);
});
with the fetch result also wanting info between the } this means it obviously thinks it stops there, hoiw do i get round this please?
Thanks
HI , I basically have made something that I require work in html but now trying to convert to get the results from data base but get this error and cant work out how to change it, if someone could help
unexpected T_STRING, expecting ',' or ';' on line 69
***********all my css and database connection and query stuff**********************
while($row = mysql_fetch_array($result)){
echo '<div class="BoxContainer">
<div class="contentBox">
<span class="inBoxTitle green">green box</span>
<!-- Demo Button! -->
<button class="botGreen" id="botSmallPic1">Picture 1</button>
</div>
</div> <!-- .BoxContainer -->
<script src="/css/static/js/box.js"></script>
<script type="text/javascript">
$("#botSmallPic1").click(function(){
$.smallBox(
{
title: "",
content: "",
color: "#ec008c",
img: "",
icon: ""
}
);
});
</script>';
}
?>
</body>
</html>
HI Thanks
It now has no error but still only creates 1 folder rather than about 200. I have tried my query seperately and it returns all of them?
Why does it stop at just making 1 folder please?
Great thanks that now works but it get s to the first line in the database and creates that as a folder then you get this error
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given on line 6
HI
I am trying to create folders from database, but get this error as im trying to make folders named field1-field2-info
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING on line 8
<?php
connection blar
connection blar
$query = "SELECT field1, field2 FROM Table";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result))
{
$dirPath = "' . $row['field1'] . '-' . $row['field2'] . '-info";
$result = mkdir($dirPath, 0755);
if ($result == 1) {
echo $dirPath . " has been created";
} else {
echo $dirPath . " has NOT been created";
}
?>
This is the example with both sets of tabs but still when I select one of the 1st set of tabs the second set fifth tab does not show info unless i click sixth tab then back to fifth?
<!-- the 1st tabs -->
<ul class="css-tabs">
<li><a href="#first-tab">info</a></li>
<li><a href="#second-tab">info</a></li>
</ul>
<!-- tab "panes" -->
<div class="css-panes">
<div>
first tab information in here
</div>
<div>
2nd tab information in here
</div>
</div>
<!-- the 2nd set of tabs -->
<ul class="css-tabs">
<li><a href="#fifth-tab">info</a></li>
<li><a href="#sixth-tab">info</a></li>
</ul>
<!-- tab "panes" -->
<div class="css-panes">
<div>
fifth tab information in here
</div>
<div>
sixth tab information in here
</div>
</div>
HI
Hope someone can help
I have 2 sets of tabs on the page both are the same code and pointing to the same css, when the page loads everything is shos fine. But if you select one of the first set of tabs the first tab on the 2nd set of tabs then does not show its info, unless you click on another tab then back again.
I have tried adding in another set of css the same but with 2 at the end and this just ends up where the 2nd set do not show info at all, or become unselectable.
Does anyone know the reason and a fix for this please
<!-- the tabs -->
<ul class="css-tabs">
<li><a href="#first-tab">info</a></li>
<li><a href="#second-tab">info</a></li>
</ul>
<!-- tab "panes" -->
<div class="css-panes">
<div>
first tab information in here
</div>
<div>
2nd tab information in here
</div>
</div>
Thanks
Thanks for the reply.
If I understand you correctly, which maybe not, I have actually done that in my query
SELECT * FROM Table1, Table2 Where Table1.field2
= 'blar' and Table1.field3
= 'blarblar' and 'table1.field1' LIKE "'%table2.field1%'" LIMIT 1
Hi
I am having an issue with a table join query whhich later I will echo results into a table.
Example
I have 2 x tables and Table1field1 has a number say 555 but table2field1 which I need to join to has 555 342 642 313 etc etc
This is what I have but it does not join.
SELECT * FROM Table1, Table2 Where `Table1.field2` = 'blar' and `Table1.field3` = 'blarblar' and 'table1.field1' LIKE "'%table2.field1%'" LIMIT 1
Hope someone can help with this
ok thanks for your help
Either , as long as it works :)
Thanks
Brilliant, that now works perfectly.
Now is it possible to help me on the other matter posted which is I dont know how to move forward after this to make a combo drop down box whereby the selected value of the first box then decides what is populated in the 2nd box and then a selection is made from there to go to that url.
HI
I seem to have a problem with a drop down menu, the code seems to work fine and the values are showing in source code but do not show on the page????
Another issue is I dont know how to move forward after this to make a combo drop down box whereby the selected value of the first box then decides what is populated in the 2nd box and then a selection is made from there to go to that url.
Hope somebody can help.
<head>
<style type="text/css">
#myForm select option:nth-child(odd) {
color:orange;
background:lightgray;
}
#myForm select option:nth-child(even) {
color:orange;
background:white;
font-colour:orange;
}
#myForm select {
background:gray;
color:orange;
}
</style>
</head>
<body>
<form id="myForm" action="#" method="get">
<select name="select1">
<option value="Select Option">Select Option</option>
<?php
$con = mysql_connect("","","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("Database", $con);
$result=mysql_query("select * from TABLE where Field='whatever' ORDER BY whatever, whatever2");
while($row=mysql_fetch_array($result))
?>
<option value="<?php echo $row['whatever']; ?>" <?php echo $row['whatever2'];?></option>
<?php
}
?>
</select>
</body>
</html>
I couldnt get it to work so just set up another field and updated with same info and used 2 fields.
Thanks for help anyway
they are in the head of the page
<?php$txt2 = "' . $file['field2']. '"; $txt7 = "' . $file['description']. '"?>
Currently nothing is coming out onto the page
Hi thanks for your help
the code itself just echos out on to the page now though?
This is the bit I need to edit really if you can help with that
<?php
if(strlen($txt7)>200){
echo substr($txt7, 0, 200) . '…';
}
else {
echo $txt7;
}
?>
Thanks
Hi I have an issue whereby I need to replace characters in a field and also narrow the amount of characters down, but sturggling with putting them both together
I have 2 seperate lines of code to do them both seperately that work, but struggling to get them together btw $txt7 is also the field description, its just the way it has ended up trying different ways to get them together :)
'. str_replace('*','' . $file['field2'] . '',trim($file['description'])) . '<p>
<?php
if(strlen($txt7)>200){
echo substr($txt7, 0, 200) . '…';
}
else {
echo $txt7;
}
?>
Hope you can help
Thanks
Hi Sorry looking at it you are correct, I simply need to take the info from the table rather than the variable, Silly me :)
Thanks for your replies guys, sorry:)
As per first post I have a variable in my head that is used for the rest of the page
eg
<?php $txt2 = "whatever"?>
then that is echoed out throughout the page where required.
Here I have a problem getting that to echo in the first post code
Thanks
Hi Thanks for your reply
I also need to echo out a points the value of $txt2
Thanks
Thanks for your reply but that option does not work either
Hi
I have variables set in the head of the page as they are used for other parts of the page.
I have a problem where by I am trying to get the variable to echo out in the result.
I have tried several ways but either ther eis an error or the variable $txt2 does not show in the page.
Its working in the query but not in the result
Hope you can help
Thanks
$result = mysql_query("SELECT * FROM table1, table2 Where field1 = '$txt2' and field2 = table1.field2") or trigger_error(mysql_error().$sql);
while($row = mysql_fetch_array($result)){
echo '<li>
<h2><a href="' . $row['$txt2'] . '/' . $row['$txt2'] . '.php">' . $row['title'] . '</a></h2>
</div>
</li>';
thanks, all sorted now
No that has not worked
Sorry found this issue, `` changes to ''
Thanks