473,671 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

passing result from query to a message box

5 New Member
I have a query created in the queries area that returns a aggregate value (a count() function).
It works if I click on it and provide a value in the prompt.
In a seperate form I want to display the result of this query.

I have tried
C1=Qry_Test!exp r1000
C1=[Qry_test]![expr1000}


neither works,

Thanks
Jan 18 '08 #1
6 3192
jaxjagfan
254 Recognized Expert Contributor
I have a query created in the queries area that returns a aggregate value (a count() function).
It works if I click on it and provide a value in the prompt.
In a seperate form I want to display the result of this query.

I have tried
C1=Qry_Test!exp r1000
C1=[Qry_test]![expr1000}


neither works,

Thanks
In an unbound textbox use =dsum("[expr1000]","Qry_test ") for the textbox rowsource. If its bound to the query just use a textbox and bind the column.
Jan 18 '08 #2
mhnaccess
5 New Member
I need to use the returned value in a test , would this work?
c1=dsum("[expr1000]","Qry_test ")
if c1> 10 then

do something
endif

Thanks
Jan 18 '08 #3
mhnaccess
5 New Member
I encounter data type mismatch on c1 = DSum("[expr1000]", "Qry_test")
with c1 declared as integer

Mike
Jan 18 '08 #4
mhnaccess
5 New Member
OK,
I have the correct method,

DSUM led me to Dcount which is

c1=c1 = DCount("*", "Table name", "[field name]=' something' ")
Jan 18 '08 #5
jaxjagfan
254 Recognized Expert Contributor
Declare C1 as a Double or Long and try again.

What value is the query returning?
Jan 18 '08 #6
prasenjitSG
1 New Member
Hi,
I am trying to develop a php page where user can write mysql query (select, insert, update) and run.

I have developed one for select query. here is the code:
<?
/*************** ************
* Author: P. Sengupta
* Used for Admin Utility only
*************** ************/
?>
<br>
<h2>Run SELECT Query</h2>
<?
$query=$_POST["query"];
?>

<form action="#" method="post">
<textarea name="query" cols="80" rows="10">
<?=$query?>
</textarea>
<br>
<input type="submit" value="Submit" /> <input type="reset" value="Reset" />
</form>

<?php

if (empty($query)) {
echo "<br>Enter query...";
exit;
}
else {
$q = str_replace (" ", "", $query);
if (string_begins_ with(strtoupper ($q), 'SELECT')) {}
else {
echo "<font color=red>Sorry ! Only SELECT statement is allowed. The query expression you entered does not seem like a SELECT statement...</font>";
exit;
}
}
//echo "here....";
include 'config.php';
//$query=" select * from store_items ";
getDBLink();
$result = mysql_query($qu ery);
if (mysql_errno()) {
echo "<font color=red>MySQL error ".mysql_errno() .": ".mysql_error() ."</font>";
exit;
}
if (!$result) {
echo "No result found... Check the query...</font>";
exit;
}
$num = mysql_num_rows ($result);
if ($num==0) {
echo "<font color=red>Zero records found</font>";
exit;
}
else {
echo "<font color=blue>$num records found.</font><br>";
}

$fields = mysql_num_field s($result);
echo "<table cellspacing=1 cellpadding=2 bgcolor=#000000 ><tr bgcolor=#cccccc >";
for($count=0;$c ount<$fields;$c ount++) {
$field = mysql_fetch_fie ld($result,$cou nt);
echo "<td>$field->name <br>($field->type)</td>";
}
echo "</tr>";
while ($row = mysql_fetch_arr ay($result, MYSQL_NUM))
{
echo "<tr bgcolor=#ffffff >";
for($count=0;$c ount<$fields;$c ount++) {
echo "<td>$row[$count] &nbsp;</td>";
}
echo "</tr>";
}
mysql_close();
echo "</table>";

function string_begins_w ith($string, $search)
{
return (strncmp($strin g, $search, strlen($search) ) == 0);
}

?>

Now I want to modify this page for working all three (select, insert and update) quires together. can anybody please help me??
MY mail id : prasenjitsengup ta2005@gmail.co m
Sep 12 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
7781
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains: ---------------------------------------------------------------------------- <?php ini_set("session.use_cookies", "off"); ini_set("session.use_trans_sid", "on"); session_start(); $_SESSION = ""; $_SESSION = ""; echo "<form method='POST' action='login.php'>
3
2075
by: redneck_kiwi | last post by:
Hi all: I have a really weird problem. I am developing a customer catalog system for my company and as such have delved into sessions for authentication and access levels. So far, I have managed to get a working system just about finished. I am building an interface for our customer service folks to use to manage registered customers and am seeing some weird behavior.
3
16940
by: WGW | last post by:
Though I am a novice to MS SQL server (2000 I believe), I can do almost! everything I need. Maybe not efficiently, but usefully. However, I have a problem -- a complex query problem... I can create a parameter query in a stored procedure, but how do I use the result set of a parameter query in a select query (in the same or another sp)? In short, if a select query contains a result table that is generated as a parameter query, how do I...
5
3571
by: Tim Menninger | last post by:
I have seen the postings about passing XML into an XSL transformation. The problem is that I cannot use any XPath navigation in the XSL that won't generate an error. If I use <xsl:copy-of select="$var"/> then the XML is output into the html page but this <xsl:copy-of select="$var/NS:Child"/>, and all other XPath navigation, fails with the error that 'The expression passed to this method should result in a NodeSet'. The real goal is to use...
6
2344
by: JackM | last post by:
I have a multiple select input in a form that's being populated by a row from my database as such: <input type=\"checkbox\" name=\"subm\" value=\"$row\"> That part is working fine as I can check the displayed page using View Source and see that the value is the correct row number from the database. It is then being submitted on a form by $_POST method to another page where I want to evaluate the checkboxes and display the contents of...
0
2410
by: kencana | last post by:
hi All, I got problem in passing data (more than one) from soap client to the soap server. but if i only passing one data at a time, it works successfully.. The following is the error message i get when i pass more than one data: "SoapFault exception: looks like we got no XML document in C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\phpviewersample\clienttry2.php:24 Stack trace: #0 : SoapClient->__call('getMap', Array) #1...
11
3786
by: kennthompson | last post by:
Trouble passing mysql table name in php. If I use an existing table name already defined everything works fine as the following script illustrates. <?php function fms_get_info() { $result = mysql_query("select * from $tableInfo") ; for ($i = 0; $i < mysql_num_rows($result); $i++) {
6
2632
by: jej1216 | last post by:
I am trying to put together a PHP search page in which the user can select none, one, two, or three fields to search, and then the results php will build the SQL with dynamic where caluses to reflect the fields chosen. The first page, where they select the search fields and submit: <?php $db = mysql_connect("localhost", "root", "yeahright"); if (!$db) { die('Could not connect:'.mysql_error);
1
1300
Chrisjc
by: Chrisjc | last post by:
First off here is the link to my page Link to page I am having an issue passing the "State" value to "dealerlocater.php" page that I have created, I have my index.php which will pull from my database and list all the States in a drop down. I now am trying to pass a selected state to “dealerlocater.php” which in return would post up all entries found in the database. How ever I am having an issue with my code could some one please...
9
1537
by: JRough | last post by:
I'm getting the error message that the parameter passed to the function is not a valid resource. The parameter is $result and it is from a query in a switch statement. What do I have to do to get it to accept it? tia, function MakeXclHeader($result){ $fields = mysql_num_fields($result); for ($i = 0; $i < $fields; $i++){
0
8392
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8912
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5692
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4403
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2809
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1807
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.