A Fluid Gallery from MySQL using PHP and various column widths
I have decided to try the new Fluid Layout option in Dreamweaver. I pull information from a database (MySQL) and use php to present it.
To show a gallery, I would pull the info and use the repeater code, and something like Tom Muck's horizontal repeater script to create a gallery. The images need to be shown with other text-based information (not just a caption). However, the HR script is a set amount of columns - and I want the number of columns to change depending on the width of the browser.
So it's more than just a gallery - pulling images from a database with Title = "x" these would be a repeated stylised DIV with multiple texts fields and styles within.
Let's take the example of a car dealership website it must show the car image, year, prices, description etc all in different style fonts so it can just be a caption to the image.
So the options are:
A fixed number of columns for each width: Monitor 5, Tablet 3, Mobile 1. Can this be achieved by having a "IF" statement in the actual code, if width = x use this version of the Horizontal Repeater?
A fluid version that has 6 columns and as you slide the browser's width you can see the gallery's width has less columns until it reaches 1 for mobile.
The fluid version would be better.
Any links to a tutorial or example would be most appreciated.
Many thanks
HVR
The only issue with using <divs> instead of a table to create your grid columns is that you will have to set a minimum height on the <divs> to keep them all at the same depth,much like a table cell construction looks and behaves. If you don't set a minimum height the grid will look all ragged PLUS the very big drawback is the <divs> won't clear if another <div> has more content in it which is going to happen if you include a 'description' of the car as this will never be the same length unless you are prepeared to edit the text.
See fluid sample below: You can just populate the <divs> from your database and loop through them
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled Document</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: verdana;
font-size: 13px;
#pageWrapper {
width: 98%;
max-width: 980px;
margin: 0 auto;
overflow: hidden;
.imageDetails {
width: 22.5%;
float: left;
margin: 0 0 15px 2%;
background-color: #CCC;
padding: 8px 0;
min-height: 200px;
dl {
margin: 0 8px;
padding: 0;
dt {
float: left;
width: 50%;
padding: 0 0 5px 0;
dd {
text-align: right;
padding: 0 0 5px 0;
h3 {
font-size: 13px;
margin: 0;
padding: 8px 8px 5px 8px;
p {
margin: 0;
padding: 0 8px;
@media screen and (max-width: 760px) {
.imageDetails {
width: 30%;
float: left;
margin: 0 0 15px 2%;
background-color: #9F3;
@media screen and (max-width: 480px) {
.imageDetails {
width: 45%;
float: left;
margin: 0 0 15px 2%;
background-color: #FC9;
@media screen and (max-width: 320px) {
.imageDetails {
width: 100%;
float: none;
margin: 0 0 15px 0;
background-color: #9CC;
</style>
</head>
<body>
<div id="pageWrapper">
<div class="imageDetails">
<img src="cars/car_1jpg" alt="">
<dl>
<dt>Price</dt>
<dd>£8500</dd>
<dt>Year</dt>
<dd>2009</dd>
</dl>
<h3>Description</h3>
<p>This is a description about the car</p>
</div>
<!-- end imageDetails -->
<div class="imageDetails">
<img src="cars/car_1jpg" alt="">
<dl>
<dt>Price</dt>
<dd>£8500</dd>
<dt>Year</dt>
<dd>2009</dd>
</dl>
<h3>Description</h3>
<p>This is a description about the car</p>
</div>
<!-- end imageDetails -->
<div class="imageDetails">
<img src="cars/car_1jpg" alt="">
<dl>
<dt>Price</dt>
<dd>£8500</dd>
<dt>Year</dt>
<dd>2009</dd>
</dl>
<h3>Description</h3>
<p>This is a description about the car. This is a description about the car. This is a description about the car.</p>
</div>
<!-- end imageDetails -->
<div class="imageDetails">
<img src="cars/car_1jpg" alt="">
<dl>
<dt>Price</dt>
<dd>£8500</dd>
<dt>Year</dt>
<dd>2009</dd>
</dl>
<h3>Description</h3>
<p>This is a description about the car</p>
</div>
<!-- end imageDetails -->
<div class="imageDetails">
<img src="cars/car_1jpg" alt="">
<dl>
<dt>Price</dt>
<dd>£8500</dd>
<dt>Year</dt>
<dd>2009</dd>
</dl>
<h3>Description</h3>
<p>This is a description about the car</p>
</div>
<!-- end imageDetails -->
</div>
</body>
</html>
Similar Messages
-
I need to know how I will create a dynamic website using php and mysql
I need to know how will I create a dynamic website using php and mysql that people could have the abilities of registering in the website, and modify their profile where they can add their pictures and everything. apart from that, they should have the ability to search about other member. hope to here more from you.
If you are a right-brained creative, and have no previous experience or propensity to be able to understand coding and database "stuff", and/or if your time can be better spent on other skills, I recommend you save your sanity and hire a developer... or at least the first time around. I have been attempting to grasp this for years... and have a library of marked up books to prove my efforts, all while trying to keep up with an ongoing client base that is always cramped. It's a wonder I still have my sanity... then again, I might not be the best person to determine that. Others might question it.
That said, I still plan to master php... one of these days. -
In download to excel from bsp hw to increase excel column width to wrap txt
in download to excel from bsp how to increase excel column width to wrap text
in each column.
My client does not want to manually click each cell aftet downloading to excel to see full text in each columnHi,
You can achieve this by formatting your output using HTML table tag.
Try the following code.
DATA: lv_output TYPE string.
concatenate
'<table border="1">'
'<tr style="font-weight: bold; text-align:center; "><td>Name</td><td width="150">Description</td></tr>' cl_abap_char_utilities=>cr_lf
'<tr><td>First Name</td><td>Some Description goes here..... ....... ...... </td></tr>' cl_abap_char_utilities=>cr_lf
'<tr><td>2nd Name</td><td>XYZ.......</td></tr>' cl_abap_char_utilities=>cr_lf
'</table>'
into lv_output.
response->set_cdata( data = lv_output ).
Regards
Geogy
PS. Reward the useful answers. -
Create a database from scratch using php.
Is it possible to create the usernames and databases for
mysql using a php script, or can this only be done using
phpmyadmin.
if it can how.
thanksSure, you should be able to execute ddl command from a php
script. Why do you want to? -
Problem with Join Queries using PHP and an Orcale Database
Ok, I am trying to build a simple php querying tool for my oracle database and for the most part it is working however I am having a problem getting data from my join queries. If I run the following query :
QUERY:
SELECT lastfirst,EnteredBy,Debit FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
RESULT SET:
Lastfirst EnteredBy Debit
caiu, test 204 1
But when I run the query correctly I get no results
QUERY:
SELECT sts.lastfirst,gl.EnteredBy,gl.Debit FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
RESULT SET:
sts.lastfirst gl.EnteredBy gl.Debit
and if I run the query combining the two above methods and adding a field (schoolid) that has the same name on both table I get the following result sets
QUERY:
SELECT lastfirst,EnteredBy,Debit,sts.schoolid FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
RESULT SET:
lastfirst EnteredBy Debit sts.schoolid
caiu, test 204 1
QUERY:
SELECT lastfirst,EnteredBy,Debit,schoolid FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
RESULT SET:
NONE
Therefore, I have to have something written incorrectly in my php code and I just can not figure it out. My entire code is pasted below please provide me with an assistance you might have to offer. I have change the odbc_connec line so I could post it to this forum. In addition, I had to phrase out the column headers there for when you write the column headers you have to use ~ instead of , as the separator and then I turn back into the correct format for sql.
//These scripts just open help windows if somone clicks on the icon
<script>
function submit()
{document.sqlform.submit();}
</script>
<script>
function colwin(){
window.open("colnames.php",null,"height=300,width=400,scrollbars=1");}
</script>
<script>
function tabwin(){
window.open("tablenames.php",null,"height=300,width=400,scrollbars=1");}
</script>
<script>
function help(){
window.open("http://www.w3schools.com/sql/default.asp",null,"height=500,width=700,scrollbars=1");}
</script>
<form method="post" action="<?php echo $PHP_SELF;?>" name="sqlform">
<?php
//Cookie to check for authorization to the site
if($_COOKIE['cookie']=="CheckCookieForAuth")
//These get the values of the textareas after the form has been submitted
$sqlSELECT = $_POST["SELECT"];
$sqlFROM = $_POST["FROM"];
$sqlJOIN = $_POST["JOIN"];
$sqlWHERE = $_POST["WHERE"];
$sqlOTHER = $_POST["OTHER"];
$sqlSELECTTYPE = $_POST["SELECTTYPE"];
//This is the variable used to parse out my headers the user entered
$sqlColNames = split('~',$sqlSELECT);
//This converts the ~ separator to , so I can actually use it as part of my sql string
$search = array('~');
$replace = array(',');
$mystring = $sqlSELECT;
$sqlString = str_replace($search, $replace, $mystring);
//These are the textareas and the drop down options that the end users has to create queries
echo "<table border=0>";
echo "<tr><td valign='top'>";
echo "<B>SELECT TYPE</B> <BR><SELECT NAME=SELECTTYPE>
<OPTION VALUE='SELECT' SELECTED>SELECT</OPTION>
<OPTION VALUE='SELECT DISTINCT'>SELECT DISTINCT</OPTION>
<OPTION VALUE='INSERT'>INSERT</OPTION>
<OPTION VALUE='UPDATE'>UPDATE</OPTION>
<OPTION VALUE='DELETE'>DELETE</OPTION>
</SELECT>";
echo "</td><td>";
echo "<textarea rows=2 cols=75 name=SELECT wrap=physical>$sqlSELECT</textarea>";
echo "</td><td valign='top'>";
echo "<img src='images/sqlC.jpg' width='25' height='25' onclick='colwin()'>";
echo "</td></tr>";
echo "<tr><td valign='top'>";
echo "<b>FROM</b>";
echo "</td><td>";
echo "<textarea rows=2 cols=75 name=FROM wrap=physical>$sqlFROM</textarea>";
echo "</td><td valign='top'>";
echo "<img src='images/sqlT.jpg' width='25' height='25' border=0 onclick='tabwin()'>";
echo "</td></tr>";
echo "<tr><td valign='top'>";
echo "<b>JOIN</b>";
echo "</td><td>";
echo "<textarea rows=2 cols=75 name=JOIN wrap=physical>$sqlJOIN</textarea>";
echo "</td></tr>";
echo "<tr><td valign='top'>";
echo "<b>WHERE</b>";
echo "</td><td>";
echo "<textarea rows=2 cols=75 name=WHERE wrap=physical>$sqlWHERE</textarea>";
echo "</td></tr>";
//This is where the end user would enter group by, having, order by, etc..
echo "<tr><td valign='top'>";
echo "<b>OTHER</b>";
echo "</td><td>";
echo "<textarea rows=2 cols=75 name=OTHER wrap=physical>$sqlOTHER</textarea>";
echo "</td></tr>";
This is a run query icon and a help icon
echo "<tr><td colspan=2 align=right>";
echo "<img src='images/RunQuery.jpg' width='30' height='28' onclick='submit()'> <img src='images/qm.jpg' border=0 width='25' height='25' onclick='help()'>";
echo "</td></tr></table>";
echo "<br>";
echo "<br>";
//This is where I connect to my remote oracle database
$conn=odbc_connect('ODBC_ConnectionName','USERNAME','PASSWORD');
//This is the sql string created by the end users
$sql="$sqlSELECTTYPE $sqlString FROM $sqlFROM $sqlJOIN $sqlWHERE $sqlOTHER";
//This executes the connection string and the sql string
$rs=odbc_exec($conn,$sql);
//This will display the query or a message if the query is empty
if($rs!=NULL){
echo "<table border=1>";
echo "<tr>";
//This loops through the string array the end user enter the field name text area to get column headers
for($i=0; $i<count($sqlColNames); $i++)
echo "<td>";
print_r($sqlColNames[$i]);
echo "</td>";
echo "</tr><tr>";
//This actually fetchs the rows from the statement and then display the data based on the column names the end user speificed
while (odbc_fetch_row($rs))
for($i=0; $i<count($sqlColNames); $i++)
$results=odbc_result($rs,$sqlColNames[$i]);
echo "<td>$results</td>";
echo "</tr>";
odbc_close($conn);
echo "</table>";}else{echo "Results will be displayed here";}
echo "<br><br>";
echo $sql;
else
echo "Not logged in";
?>
</form>This looks more like a SQL question than a PHP issue. There are a couple of JOIN examples at http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_10002.htm#i2066611 that might you work through the problem.
-
Error while importing the tables from MySQL using the data source connection
Hi,
I am trying to import tables from MySQL into Powerpivot using the data source connection, if use the import using the Query option its working fine but not with the select list of table option.
when i click on the select list of tables option, i get the below error after selecting all the tables to be imported:
OLE DB or ODBC error.
An error occurred while processing table 'XXXXXXXXXX'.
The current operation was cancelled because another operation in the transaction failed.Hi Bharat17an,
Please provide the detail information when create the MySQL connection in your PowerPivot model. Here is a good article regarding "how to Use MySQL and Microsoft PowerPivot Together" for your reference, please see:
http://www.datamensional.com/2011/09/how-to-use-mysql-and-microsoft-powerpivot-together-2/
If this issue still persists, please help to collection windows event log information. It maybe helpful for us to troubleshoot this issue.
Regards,
Elvis Long
TechNet Community Support -
DW crashes when I use PHP and HTML
Hi, I need to use PHP with DW to validate a form.
However, when I use PHP with HTML DW crashes. I use a PHP
script to to select the correct radio button when the form is
submitted (see below).
It works fine in the browsers and I can even edit in Notepad.
I am not sure how to solve this - I altered the DTD from
strict to transitional (it didn't work). I am using the latest
version of DW CS3.
Any ideas?
<dt>How did you find out about the site?</dt>
<dd>
<label for="how_did_you_find_out_about_the_site1">
<input name="how_did_you_find_out_about_the_site"
id="how_did_you_find_out_about_the_site1" type="radio"
value="Link_from_another site" <?php echo
($_POST["how_did_you_find_out_about_the_site"] ==
"Link_from_another site") ? "checked=checked" : "";?> />
Link from another site</label>
</dd>
<dd>
<label for="how_did_you_find_out_about_the_site2">
<input name="how_did_you_find_out_about_the_site"
id="how_did_you_find_out_about_the_site2" type="radio"
value="Read_about_it_in a_booklet_or_card" <?php echo
($_POST["how_did_you_find_out_about_the_site"] == "Read_about_it_in
a_booklet_or_card") ? "checked=checked" : "";?> />
Read about it in a booklet/card</label>
</dd>
<dd>
<label for="how_did_you_find_out_about_the_site3">
<input name="how_did_you_find_out_about_the_site"
id="how_did_you_find_out_about_the_site3" type="radio"
value="Recommended_by_my tutor" <?php echo
($_POST["how_did_you_find_out_about_the_site"] ==
"Recommended_by_my tutor") ? "checked=checked" : "";?> />
Recommended</label>
</dd>
<dd>
<label for="how_did_you_find_out_about_the_site4">
<input name="how_did_you_find_out_about_the_site"
id="how_did_you_find_out_about_the_site4" type="radio"
value="Found_it_when_I_used_the_search" <?php echo
($_POST["how_did_you_find_out_about_the_site"] ==
"Found_it_when_I_used_the_search") ? "checked=checked" : "";?>
/>
Found it when I used the search</label>
</dd>
<dd>
<label for="how_did_you_find_out_about_the_site5">
<input name="how_did_you_find_out_about_the_site"
id="how_did_you_find_out_about_the_site5" type="radio"
value="Other" <?php echo
($_POST["how_did_you_find_out_about_the_site"] == "Other") ?
"checked=checked" : "";?>/>
Other</label>
<label
for="how_did_you_find_out_about_the_site6">(please specify)
<input name="how_did_you_find_out_about_the_site_specify"
id="how_did_you_find_out_about_the_site6" type="text"
value="<?php echo ($_POST["how_did_you_find_out_about_the_site"]
== "Other") ? $_POST["how_did_you_find_out_about_the_site_specify"]
: "";?>"/>
</label>
</dd>Steve84 wrote:
> Hi, I need to use PHP with DW to validate a form.
>
> However, when I use PHP with HTML DW crashes.
http://www.adobe.com/go/kb402776
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
I try to load libary.swf from an swc file in order to use it's library items.
i load the library.swf using urlrequest and loader() and then use getDefinition() to fetch the class definition
of the UIMovieclip element.
i simply created the swc file by adding library assets to an swf file, converting them to a flex component and extending each compoent with the UIMovieClip class.
when i load the swf file from a url (http) i get the following error:
VerifyError: Error #1053: Illegal override of UIMovieClip in mx.flash.UIMovieClip.
when i load the file locally, i get no error. any ideas why?
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="init()">
<fx:Script>
<![CDATA[
import mx.core.UIComponent;
import mx.flash.UIMovieClip;
private var _context: LoaderContext;
private var _request: URLRequest;
private var _loader:Loader;
private var _library:Object;
private var _executeFunction:Function = null;
public function _setExecuteFunction(f:Function):void {
this._executeFunction=f;
public function handleLibInitialized(e:Event):void {
this._library=e.target.applicationDomain;
var a:Class = this._library.getDefinition("lobby_page_component");
var b:MovieClip = new a() as MovieClip;
var c:UIComponent = new UIComponent();
c.addChild(b);
this.addElement(c);
public function init():void {
Security.allowDomain("*");
var url2:String="http://url/for/library.swf"; <- http provides an error
var url2:String="/path/to/library.swf"; <- local path works
this._context = new LoaderContext(false,ApplicationDomain.currentDomain);
this._request = new URLRequest(url2);
this._loader = new Loader();
this._loader.contentLoaderInfo.addEventListener(Event.INIT,this.handleLibInitialized);
this._loader.load(this._request,this._context);
]]>
</fx:Script>
</s:Application>hello,
thanks for trying to help.
if this is the case, why it happens only when i load the library.swf file from an http location instead of a local location ?
how can i make sure that my adobe flash has the same UIMovieClip version?
kfir -
How to set and fix column widths in Mavericks?
Until recently I was using a Mid 2011 MBA with OS X 10.8.X.
I don't know what I did but the column widths in the Finder started to self-adjust to the longest filename.
Now I have migrated my user account from this MBA to a new MBP running OS X 10.9.1.
But the Finder in this account still has the same affliction, I can adjust column widths to where I want them but as soon as I click on a file or folder, the column widths readjust to the length of the longest file/folder name.
How can I stop the Finder from doing that automatically?
Thanks for your help and Happy Holidays!Dear William Lloyd:
I actually learnt how to do this from another post in this community just a few hours ago.
You adjust column wisth in Finder by placing your curser at the column edge and while holding Option key down, move column edge to the width you desire.
This will make a "sticky" change i.e., column widths will stay where you set until you chanage them.
I would like to to attribute this to the poster I learnt from but I am not able to find that post again.
Cheers.
rdfNaresh -
Applescript/Pages and adjusting column width (and paragraph style)
I was hoping that some someone might know how to adjust the width of individual columns in Pages using Applescript. It seems like it should be a simple task, and I can adjust the overall width/height of the table, but I haven't found a way to adjust the column width. Alternatively, I could have the program create the table in Numbers and copy/paste it into Pages, but I'd imagine that would get a bit messy and wouldn't allow me to use a hanging indent in the cells (to the best of my knowledge).
Also, is there a way to adjust the paragraph style used by the text in the table? Otherwise, I could just use a templet and define the the default table style appropriately. (Though not the most elegant solution).
Thanks in advance for your help!
(In case it helps, the script I'm working on parses an unformatted inventory and parses it into paragraphs/tables.)Try this:
set tableCount to 0
--open file to be pased here, excluded for example
tell application "Pages"
activate
set theDoc to (make new document)
tell theDoc
--makes paragraph styles used
make new paragraph style with properties {name:"Folio", font name:"Times New Roman", font size:12, bold:true, alignment:left, space after:5, keep with next paragraph:true, space before:15}
make new paragraph style with properties {name:"Place", font name:"Times New Roman", font size:12, bold:false, alignment:left, line spacing type:relative, line spacing:100}
make new paragraph style with properties {name:"Description", font name:"Times New Roman", font size:12, bold:false, italic:true, alignment:left, line spacing type:relative, line spacing:100}
make new paragraph style with properties {name:"Table", font name:"Times New Roman", font size:12, alignment:left, left indent:0.5, first line indent:0.0}
--begin repeat, gathers MS info from one doc (unformatted) and writes it into another with formatting, setting variables directly for example
set MSName to "new Manuscript"
set MSPlace to "place where MS is stored"
set MSDesc to "description of MS"
set tableData to {{"folio", "title", "composer"}, {"", "subtitle", ""}, {"etc", "next", "next"}}
--write paragraph information from earlier
set currentPar to (make new paragraph at end of paragraphs with data MSName)
set paragraph style of currentPar to "Folio"
set currentPar to (make new paragraph at end of paragraphs with data MSPlace)
set paragraph style of currentPar to "Place"
set currentPar to (make new paragraph at end of paragraphs with data MSDesc)
set paragraph style of currentPar to "Description"
--create table, add data, and format
tell application "System Events" to tell process "Pages"
key code 125 using {command down} -- move the insertion point to the end
tell menu bar 1
-- Insert a new table:
click menu item "Table" of menu 1 of menu bar item "Insert"
-- Delete the header row:
tell menu 1 of menu bar item "Format"
click menu item "Delete Row" of menu 1 of menu item "Table"
end tell
-- Show the Inspector:
tell menu 1 of menu bar item "View"
if menu item "Show Inspector" exists then
click menu item "Show Inspector"
end if
end tell
end tell
tell window 1 -- the Inspector window
click radio button 7 of radio group 1 -- select the Table Inspector
perform action "AXRaise" -- activate the Table Inspector
tell tab group 1 of group 1
click radio button "Table" -- select “Table”
-- Reduce width of all three columns:
repeat 3 times
set value of text field 2 to "0.5 in"
set focused of text field 2 to true
keystroke return
keystroke tab -- next column
end repeat
key code 126 -- the Up Arrow
-- Set width of each column:
repeat with theValue in {"0.75 in", "4.25 in", "1.5 in"}
set value of text field 2 to theValue
set focused of text field 2 to true
keystroke return
keystroke tab -- next column
end repeat
key code 126 -- the Up Arrow
end tell
end tell
keystroke "i" using {option down, command down} -- hide the Inspector
-- Add the data:
repeat with i from 1 to 3
set thisRow to item i of tableData
repeat with j from 1 to 3
keystroke (item j of thisRow)
if (i * j = 9) then exit repeat
keystroke tab
end repeat
end repeat
end tell
set tableCount to tableCount + 1
tell table tableCount
select
set stroke width to 0.0
set wrap to center
set name to MSName
end tell
--after which it would continue with the next MS and repeat the process until all are done
end tell
end tell -
How to use html Tags from MySQL with PHP
I like HTML tags like <b>bold</b> or <BR>
and others placed in the MySQL database and used by PHP to show up
in my pages but I don't succeed. I tryied HTML encode
(htmlentities) from the bindings POP-up menu but nothing happened.
What is the way this should be acomplished and where is HTML
encode (and the others in the pop-up menu) being used for?
Any help will be appreciated,
Josarnhemcs wrote:
> I like HTML tags like
bold or <BR> and others placed in the MySQL
> database and used by PHP to show up in my pages but I
don't succeed. I tryied
> HTML encode (htmlentities) from the bindings POP-up menu
but nothing happened.
Just store the HTML as plain text in your database. Using
htmlentities()
turns < into < and so on. Using it is what's
preventing your HTML
from displaying correctly.
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/ -
Retriving data from database using JDBC and mysql.
st=con.createStatement();
st.executeUpdate("INSERT INTO temperature(`temp`) VALUES ('"+name+"')"); ResultSet rs = st.executeQuery("Select * from temperature");
String s1="";
while(rs.next())
s1= rs.getString(1);
document.write(s1+"-----------------------------");
}when i am retriving data from data base i am getting data which i inserted before.how to display present inserted data? i heard we should use scrollable.can any one how to do this.
Date&time: Thu Feb 28 18:41:40 PST 2008 -----------------------------NANDA----------------------------
[[email protected]----1name=2name=3name=4name=5name=6-----------------------------
1123456-----------------------------123456-----------------------------1,2,3,4,5,20-----------------------------Hi,
st=con.createStatement();
st.executeUpdate("INSERT INTO temperature(`temp`) VALUES ('"+name+"')");
//Changes in the query
ResultSet rs = st.executeQuery("Select * from temperature where temp ='"+name+"' ");
String s1="";
while(rs.next())
s1= rs.getString(1);
document.write(s1+"-----------------------------");
//Select * from temperature where temp ='"+name+"'
The above query which results the last updated information -
i have made a MYSQL_ECMA.dll (using sql_ecma.dll) but when i create that ECMA it is unable to create get_schemafrom my sql
Database=test
table=HR
public Schema GetSchema(KeyedCollection<string, ConfigParameter> configParameters)
Microsoft.MetadirectoryServices.SchemaType personType = Microsoft.MetadirectoryServices.SchemaType.Create("Person", false);
myServer = configParameters["Server"].Value;
myDB = configParameters["Database"].Value;
myTable = configParameters["Table"].Value;
DataSet myData = this.MYSQLSchema(myServer, myDB, myTable);
string[] MYSQLSchema =new string[myData.Tables["Columns"].Rows.Count];
for (int i = 0; i <= myData.Tables["Columns"].Rows.Count - 1; i++)
MYSQLSchema[i]=myData.Tables["Columns"].Rows[i].ItemArray.GetValue(0).ToString().Trim();
string myattrib=MYSQLSchema[i];
if (myattrib == "EmployeeID")
personType.Attributes.Add(SchemaAttribute.CreateAnchorAttribute(myattrib, AttributeType.String));
else
personType.Attributes.Add(SchemaAttribute.CreateSingleValuedAttribute(myattrib, AttributeType.String));
Schema schema = Schema.Create();
schema.Types.Add(personType);
return schema;
public DataSet MYSQLSchema(string server,string database, string table)
myconnectionc =("Server = '" + server + "';Initial Catalog='" + database + "';Integrated Security=True");
conc =new MySqlConnection(myconnectionc);
cmdc =new MySqlCommand();
cmdc.CommandType=CommandType.Text;
string cmdtextc="Select COLUMN_NAME from Information_Schema.Columns where TABLE_Name = '" + table + "'";
cmdc.CommandText=cmdtextc;
cmdc.Connection=conc;
adapter =new MySqlDataAdapter(cmdc);
dac =new DataSet();
adapter.Fill(dac, "Columns");
return dac;It must be problem with your query. You are converting date into DD/MM/YYYY format and passing it to the query. As per my knowledge, MySQL default date format is YYYY-MM-DD. YYYY-MM-DD is not equal to DD/MM/YYYY. Hence you would not get any result. I would suggest you to validate the query. yOu try executing query directly in mySQL
select edate, particulars, chequeno, fromto, deposit, withdrawal, cleared,cdate, details from passbook WHERE edate BETWEEN 01/01/2007 and 31/12/2007 order by edate desc
If you are able to execute above query in MySQL without fail, then it is something we may need to investigate further. Hope above query may not yields you any records. If so, that could be the problem. You may need to convert your date (SimpleDateFormat) in below format:
YYYY-MM-DD.
It should work. Let me know, still if you have any questions further. -
Retrieving Images from Mysql with PHP
Hi I have been trying to work this out with no success so some help would be really appreciated.
I have two tables in Mysql,
IMAGES AND EXHIBITORS
IMAGES
`image_id` INT(5) UNSIGNED NOT NULL AUTO_INCREMENT ,
`filename` VARCHAR(255) CHARACTER SET 'latin1' COLLATE 'latin1_bin' NOT NULL ,
`mime_type` VARCHAR(255) CHARACTER SET 'latin1' COLLATE 'latin1_bin' NOT NULL ,
`file_size` INT(11) NOT NULL ,
`file_data` LONGBLOB NOT NULL ,
`user_id` VARCHAR(50) CHARACTER SET 'latin1' COLLATE 'latin1_bin' NOT NULL ,
`accom_id` INT(5) NOT NULL ,
`exhibitors_exhib_id1` INT(5) NOT NULL ,
PRIMARY KEY (`image_id`, `exhibitors_exhib_id1`) ,
INDEX `user_id` (`user_id` ASC) ,
INDEX `accom_id` (`accom_id` ASC) ,
INDEX `fk_images_exhibitors2` (`exhibitors_exhib_id1` ASC) ,
CONSTRAINT `fk_images_exhibitors2`
FOREIGN KEY (`exhibitors_exhib_id1` )
REFERENCES `christmas_shopping`.`exhibitors` (`exhib_id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 7
DEFAULT CHARACTER SET = latin1
COLLATE = latin1_bin
EXHIBITORS
`exhib_id` INT(5) NOT NULL AUTO_INCREMENT ,
`exhib_name` VARCHAR(50) CHARACTER SET 'latin1' COLLATE 'latin1_bin' NOT NULL ,
`exhib_years` SET('2010', '2009') NULL ,
PRIMARY KEY (`exhib_id`) )
ENGINE = InnoDB
AUTO_INCREMENT = 3
DEFAULT CHARACTER SET = latin1
COLLATE = latin1_bin
PACK_KEYS = DEFAULT
I think I am happy with the Mysql, and I have read the various arguments about storing images in mysql but for my purpose I wanted to store the image in the database.
I have already created the upload and the images have uploaded correctly and I can see the data in the database, however I just have been able to retrieve the images back into a webpage.
I have a .php file which is merging these to tables correctly but the image is displayed as
o¿9®áŸÇ½G_ŒÁ%×Úoíø$M©7ûiè Óµ|Mn.˨â=Ž2Z ¥<º½Hs/¸úfŠÇðïˆ-üE`· ¯üq÷C[ öTªÂ´ Jnéžl¢âÜdµ (¢µ$(¢Š�(¢Š�(¢Š�(¢Š�(¢Š�(¢Š�CÅ Š:šZ�(¢Š�(¢Š�) -! ¢Š(�¢Š(�¢Š(�¢Š(�¢Š(�¢Š(�¢Š(�¢Š(�¢Š(�¢Š(�¯ ý¤Z_ x^óÐK2ZJ»¦ò>ô»NJ ûç¥{6½©.‘£ÝÞ ÆZ¼*-Sûz"$pÌ]$þ%5ù¿ æ•0˜xa©;9êý O›=¼³ ªÍÔžÈøžþ t·[c*¦À T?wøQ·/?ίøWÅ×z]Ü r츌þæLôoâVþð¯jøÍð¶O Y½Îœ¨Œ›–k4OšWþê·mß1÷/ Abž<[Þ¢þþÕŠþ÷û۝}nCžÏ*š¡]Þ“ü?¯ëÏ‹ …X¨óÇIþgÔÔVf‹¬Ûë¶)snÙVê½Á:ý¶ H©ÁÝ=–iÅÙî QEh ¢Š(�¢Š(�¢Š(�¢Š(�¤4´‚€ Š( Š( Š( Š( qKHh Ð ÑE �QE �QE �QE �V^½ª¦‡¥^²ï .í¾µ©^kñÿ�Z Ã]NmÛY“
The code I have in the page is as follows. After many hours of trying to work it out I just cant see what I am missing and would really appreciate some help. I have highlighted where the echo is that relates to my image.
<?php require_once('../Connections/christmas.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_christmas, $christmas);
$query_Recordset1 = "SELECT exhibitors.exhib_name, images.file_size, images.file_data FROM images, exhibitors WHERE images.exhib_id = exhibitors.exhib_id";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $christmas) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php $pagetitle="The Christmas Shopping Fayre"?>
<html xmlns="http://www.w3.org/1999/xhtml" >
<meta http-equiv="Content-Type" content="; charset=" />
<link href="../public/CSSFiles/oneColElsCtrHdr.css" rel="stylesheet" type="text/css" />
<link href="../public/CSSFiles/whitebackground.css" rel="stylesheet" type="text/css"/>
<link href="../public/CSSFiles/shoppingonline.css" rel="stylesheet" type="text/css"/>
<link rel="icon" type="image/x-icon" href="http://www.gravatar.com/avatar/c4dac336c5be729fc542c12bfbb50099.png" />
<!--[if IE]>
<style type="text/css">
a { zoom: 1;}
</style>
<![endif]-->
<script type="text/javascript">
<!--
function MM_showHideLayers() { //v9.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3)
with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
//-->
</script>
</head>
<body id="shoppingonline" class="oneColElsCtrHdr">
<p> </p>
<?php include("includes/header.php"); ?>
<br />
<br />
<div id="bannersp"> </div>
<h1>Welcome to <?php echo $pagetitle?></h1>
<p>
</p>
<form method="post" name="form1" id="form1">
<p> </p>
<table border="1" cellpadding="5" cellspacing="5">
<tr>
<td>exhib_name</td>
<td>file_size</td>
<td>file_data</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['exhib_name']; ?></td>
<td><?php echo $row_Recordset1['file_size']; ?></td>
<td><?php echo $row_Recordset1['file_data']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<?php include("includes/footer.php"); ?>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>Hi Murray
You must despair with beginers like me, attachments showed as having been
sent so lets try again.
I have been able to find a tutorial that works well all the way through, I
can even see the images in the browser!! but only shows images individually
on a page.
http://www.phpriot.com/articles/storing-images-in-mysql/7
However, what I want to do is to have a page that links my images table and
another table, all of which I have set up and is working other then showing
the images. All was very straight forward until sorting out the image. If
I can work out what to take from the above tutorial that works into my page,
I am sure all will be fab.
Storing them in the mysql was my preferred method as there are not alot and
they can be low resolution and I thought it would be fairly straight
forward!! however finding out that I am having to adapt code as dreamweaver
doesn't support the blob attribute is getting me out of my knowledge.
All the best
Gilly
Attachments inserted
show_image.php
<?php require_once('../Connections/getImage.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$colname_Recordset1 = "-1";
if (isset($_GET['image_id'])) {
$colname_Recordset1 = $_GET['image_id'];
mysql_select_db($database_getImage, $getImage);
$query_Recordset1 = sprintf("SELECT image_id, mime_type, file_data FROM images WHERE image_id = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $getImage) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
header('Content-type: ' . $row_getImage['mime_type']);
echo $row_getImage['file_data'];
mysql_free_result($Recordset1);
?>
view.php
<?php require_once('../Connections/getImage.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_getImage, $getImage);
$query_Recordset1 = "SELECT * FROM images";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $getImage) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table border="1" cellpadding="5" cellspacing="5">
<tr>
<td>image_id</td>
<td>filename</td>
<td>mime_type</td>
<td>file_size</td>
<td>file_data</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['image_id']; ?></td>
<td><?php echo $row_Recordset1['filename']; ?></td>
<td><?php echo $row_Recordset1['mime_type']; ?></td>
<td><?php echo $row_Recordset1['file_size']; ?></td>
<td><?php echo $row_Recordset1['file_data']; ?></td>
<td><img src="show_image.php?image_id=<?php echo
$row_getdetails['image_id']; ?>" alt="Image from DB" />
</td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?> -
How to use Php and Oracle on 2 different systems
Hi!
I connected with a net 2 systems. One (Windows 2000 + Oracle9i) is the database server. The other (WinXP + Apache 2.0.54 + Php 5.0.4 ) is the web server. I'd like to make the WinXP machine connect on the Win2000 but It seems it doesn't work even if I'm using:
oci_connect( "<user>" , "<pwd>" , "//<ip>:<port>/<db-name>" );
the error is always "_oci_open_server: ORA-06401: NETCMN: designatore del programma di gestione non valido"
(translated: "NETCMN: invalid gestion management program")
can someone help me?
Thanx a lot!!ORA-06401, 00000, "NETCMN: invalid driver designator"
Cause: The login (connect) string contains an invalid driver designator.
Action: Correct the string and re-submit.
The //ip:port/sid connect string will only work with 10g clients.
Check your tnsnames.ora file. Does the file have control characters or missing carriage-return characters ? (Maybe you ftp'd the file from a unix box ?)
I would suggest that you create a new tnsnames.ora - hand edit it (don't copy the old one). If you have sqlplus client - try using it to connect to the remote DB first.
The instructions for connection to a local or remote DB are all the same (when using plain OCILogon) because the connection is made over TCP.
Maybe you are looking for
-
Since a few days when I try to copy or move files on my macbook, I often get an error message saying "This operation could not be completed because an unexpected error occured (error code -8062)". And then it just quits the copy or move. I searched a
-
Can't send iMessage after update to IOS 7 on iPhone 5
After I update to IOS 7 on iPhone 5 the iMessage function seems not working properly. when I trying to send iMassage the "sending" bar loads up to 90% (slowly) and then stops dead and doesn't move. It stays at that 90% mark until it either starts wor
-
When I first turn on Firefox, I only get a blank "new tab". It does not go to the Firefox Home Page. When I click on the Home button in the top right, I get the message "The URL is not valid and cannot be loaded." How can I fix this so when I open Fi
-
Command lines for compiling forms
Hi all, I want to know if there are command lines producing the actions equivalent of Maj+Ctrl+K and Ctrl+T when we are working with a form. Thank you very much indeed.
-
Vertical alignment in Smartforms.
Hi, I am working in a smartform, where my requirement is i have to place the text both vertically and horizontally center aligned. Now i have used to center aligned in my style. but the text is horizontally center aligned not vertically. Please help